Index of ServiceLayers in a Map

617
2
11-15-2011 04:14 AM
UrsRichard
New Contributor II
Hi there,

I have a map with serveral different MapServiceLayers (DynamicMapServiceLayers and FeatureLayer). Now I'm looking for indexes of each of this services in the map. So I like to know which is the topmost, the second topmost etc..

With the information about the indexes I can as as example the map.reorderLayer(layer, index) function for reordering.

best regards

Urs
0 Kudos
2 Replies
SanajyJadhav
Occasional Contributor II
You can use LayerInfo object to get the sub layer IDs.

This documentation talks about LayerID proprty of the feature layer

Hope this helps.
0 Kudos
HemingZhu
Occasional Contributor III
Hi there,

I have a map with serveral different MapServiceLayers (DynamicMapServiceLayers and FeatureLayer). Now I'm looking for indexes of each of this services in the map. So I like to know which is the topmost, the second topmost etc..

With the information about the indexes I can as as example the map.reorderLayer(layer, index) function for reordering.

best regards

Urs


All layers has a id property. Even though it is a string type. you could name the layers '0', '1', '2'.... Since javascript is loosely typed, those ids can be easily treated as number with min code.
0 Kudos