Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My ArcGIS JavaScript application is using an ArcGIS Server Map Service that has a bunch of layers. It also has a group layer. The structure is:


After the service being loaded, it not only loads group_layer_0 (which shows layer_1 & layer_2), but also loads layer_1 and layer_2 as individual layers. In other words, layer_1 (or layer_2) is loaded twice. When I turned off group_layer_0, layer_1 is still visible because of the visibility of individual layer_1.

how should I do to avoid this? which means, when I turned off group_layer_0, it would turn off all its sub_layers; but when i turned off layer_1, it would only affect layer_1; besides, layer_1 should be loaded once, instead in current case being loaded as part of group layer and also as an individual layer.

I hope I explained this clearly. and thanks for any help!



If want to turn off layer_1, i did:

var visibleLayers = mapServiceLayer.visibleLayers;
var newVisibleLayers = removeLayerIDFromLayerList(visibleLayers, 1); 
//remove layer_1's layer ID from current visibleLayers; 
//removeLayerIDFromLayerList is a developer-defined function

//update visible layers based on new list

In the above example, I turned off layer_1, but the new visible layer list still include group_layer_0, since there is no manipulation on this group layer's visibility. and the outcome is layer_1 is still visible. which doesn't make any sense. layer_1 should be off, even though it's part of a group layer.

but this is not the case, at least in my application.

share|improve this question
You could try to adjust the settings for display by scale for the group layer, as well as the display by scale for the individual layer. – JLP Wisc. Jan 7 '13 at 16:50
thanks for your help, @JLP Wisc. I added more to the question. hope that makes it easier to understand. – Simon Jan 7 '13 at 20:56
Is single fused map cache false? See answer here. – Kirk Kuykendall Jan 9 '13 at 19:57
up vote 3 down vote accepted

The behavior of groups using the API is different than in ArcMAP TOC. This is how I understand your layerIDs:

a. LayerID0 LayerID1 LayerID2
b. LayerID1
c. LayerID2
d. LayerID3
e. LayerID4

If you turn on group layer (a), then all sublayers will be displayed.
If you turn off group layer (a) but turn on layer (b) or (c) then only layers will display.
If you turn off layers (b) or (c) and group layer (a) then none will display.

Here's an outdated but possibly relevant link to ESRI's forum topic on group layers.

Also, pardon my reiteration from my comment, but because the group layers are treated differently in the UI you could use this to your advantage by using different scale displays depending on how you are using the information in your app.

Hope this helps.

share|improve this answer
this explains the logic underlying group layer display. even though not 100% agree with this logic. – Simon Jan 10 '13 at 18:24
yeah. we don't use groups in map services for this reason. – JLP Wisc. Jan 10 '13 at 21:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.