AnsweredAssumed Answered

ArcGISDynamicMapServiceLayer: unwanted layers included in render

Question asked by greenkarmic on Mar 6, 2017
Latest reply on Mar 8, 2017 by greenkarmic

I have an issue where the image render returned by the MapServer does not seem to correspond to the list of visibleLayers specified in the ArcGISDynamicMapServiceLayer. It seems all child layers of a group layer are rendered, whether they are included in the list of visibleLayers or not.


ArcGIS API for JavaScript 3.19

ArcGIS Server 10.3.1


Here is an example of a group layer 256 with child layers 257 to 270




Using a layers widget binded to the list of visibleLayers of the ArcGISDynamicMapServiceLayer, if I check one of the child layer, this is export request sent by the API:






You can see that only 256 and 270 are included in the layers parameter of the export request, yet the MapServer will render ALL sublayers 257 to 270.


Is this the default behaviour of the MapServer??

If so, how do I work around this?


I'm thinking maybe I could manually remove group layers in the list of visibleLayers of the ArcGISDynamicMapServiceLayer, but that could create issues with the layers widget, where the group layer would be unchecked too (since it's binded to it), which is not what we want.


I see the export request (Export Map (Operation) ) layers parameter also include an "exclude" option. Is there a way I could exclude all unchecked layers using a setting or option in the ArcGIS JavaScript API? Otherwise how would I do this?






Here is a more obvious example with an infrastructure group layer:


Only child layer 168 is included in the list

But it renders them all: