MapImageLayer - set renderers on sublayers

This device does not support 3D.

View the system requirements for more information.

The sublayers property of a MapImageLayer allows you to dynamically set renderers on the fly for layers in a map service. To do so, you must reference the layer ID of the service layer and assign a renderer to the renderer property of the sublayer.

var layer = new MapImageLayer({
  url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
  sublayers: [
    {
      id: 2,
      renderer: new SimpleRenderer({
        symbol: new SimpleMarkerSymbol({
          size: 3,
          color: "white"
        })
      })
    }
  ]
});

To see the default renderers for layers in the map service, either remove the renferences to the renderers defined in this sample or view the MapImageLayer - Toggle sublayer visibility sample.

Sample search results

TitleSample

There were no match results from your search criteria.