How to modify renderer on one single layer?

884
4
10-29-2012 08:57 AM
Joachim_EckboJuell
New Contributor III
Hi,

We have a rather complex dynamic map service with a lot of layers. And we would like to change the renderer on one of the layers in the export call, using dynamicLayers. But when we do so, only this single layer is drawn. How can we alter a renderer using dynamicLayers without having to supply all the rest of the layers along in the dynamicLayers-parameter?

Here is a sample, where I alter the renderer for the highways, and only this layer is drawn.
http://servicesbeta2.esri.com/arcgis/rest/services/USA/MapServer/export?bbox=-106.08211428430971%2C3...

Thanks!
Tags (2)
0 Kudos
4 Replies
TanuHoque
Esri Regular Contributor
jjuell,

That is the nature of dynamicLayers - map service only draws the layers that are defined in dynamicLayers parameter.
Please note:

  • you must include all layers in dynamicLayers parameter that you want to *show* on the map

  • do not include 'invisible' layers

  • the order of layers in the dynamicLayers are important, as that is the order they will be drawn by the map service

  • when a dynamicLayer refers to an existing layer with scale-visibility range, map service honors that scale-visibility


Since you are not modifying renderer for other layers, the definition of each layer by pointing its source to an existing layer should be pretty compact comparing to the defining a layer with renderer and/or labels...
here is an example:

[
{
    "id": 101,
    "source": {
        "type": "mapLayer",
        "mapLayerId": 1
    },
    "drawingInfo": { "renderer": { ... }, ... }
},
{
    "id": 102,
    "source": {
        "type": "mapLayer",
        "mapLayerId": 2
    }
},
{
    "id": 103,
    "source": {
        "type": "mapLayer",
        "mapLayerId": 3
    }
},
....
]
0 Kudos
Joachim_EckboJuell
New Contributor III
Thank you for the reply. I was afraid that was the answer... That makes it quite complex to change just the symbology of one out of a few hundred layers in an existing service (I know that this number of layers is not recommended - but sometimes it has to be this way). Anyway, thanks.
0 Kudos
TanuHoque
Esri Regular Contributor
jjuell,
Just wondering, are you not using any of Web API for ArcGIS Server? If you are using one of those APIs, then it should be very simple to write the code -- the API takes care of the complexity.
Please let me know if I'm missing anything.

Thanks.
Tanu
0 Kudos
Joachim_EckboJuell
New Contributor III
In this case, the customer is using the REST API directly to export images. But they might still do some scripting to retreive the correct layerIDs etc. from the service (in case something changes). You are not missing anything 🙂

-Joachim
0 Kudos