Select to view content in your preferred language

Group layer: sub-layer visibility

1103
4
04-23-2010 11:59 AM
JamesMolohon
Emerging Contributor
Hello,
I'm trying to set the visibility of a sub layer of an ArcGISDynamicMapServiceLayer by removing the index of the layer from the VisibleLayers array.  I'm able to get this to work for layers that are not part of a group.  Is this possible?  Can anyone share an example?

Regards,
James
0 Kudos
4 Replies
JamesMolohon
Emerging Contributor
For example, I have a dynamic map service that has layers like this:
Layers:

  • Background (0)


    • Roads Overview (1)

    • Airport (2)

    • Parks (3)

  • Buildings (4)

  • Roads (5)


I would like to hide the Airport layer, so I removed 2 from the VisibleLayers array, but it is still visible.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
It should work the same way when a sublayer is part of a group.

Look with Fiddler or Firebug what the url to get the image is. You should see a layers parameter with the list of visible layers.

/Dominique
0 Kudos
BedaKuster
Deactivated User
The REST interface uses an other "Visibility Management" as the SOAP Interface.

If you set the Visibility of a grouplayer to visibile (add the id to the list) all sublayers will be visible. To hide one sublayer, remove the grouplayer id and add each visible sublayer id.

Background (0)
[INDENT]VisibleLayer(1)[/INDENT]
[INDENT]VisibleLayer(2)[/INDENT]
[INDENT]InvisibleLayer(3)[/INDENT]

If id 0 is in the VisibleLayers array, all sublayers are visible. So remove id 0 and add 1 and 2.

Hope this helps
0 Kudos
DrewDowling
Frequent Contributor
Thanks you this was killing me. I couldn't figure out why sublayers that were not on by default kept appearing when I toggled a group layer. I found no documentation about this and it is different than how ArcMap works.
0 Kudos