Getting Dynamic Map Service Layer Name On ArcGIS API

2668
1
Jump to solution
05-27-2016 12:01 PM
BehrouzHosseini
Occasional Contributor

Can you please take a look at This Demo and let me know how I can get the Selected Layer Name through API when check boxes are checked?

As you can see at This Link the service is providing 3 layers as:

enter image description here

and I need to get these names as they are selected I already tried the Request layer info but this seems retuns metadata about fields only Thanks

0 Kudos
1 Solution

Accepted Solutions
RichardAbram
New Contributor III

LayerInfos has the information. 

so 

layer.layerInfos[0].name returns Cities

layer.layerInfos[1].name returns Rivers

layer.layerInfos[2].name returns States

layer is the ArcGISDynamicMapServiceLayer for that service in your example.

View solution in original post

1 Reply
RichardAbram
New Contributor III

LayerInfos has the information. 

so 

layer.layerInfos[0].name returns Cities

layer.layerInfos[1].name returns Rivers

layer.layerInfos[2].name returns States

layer is the ArcGISDynamicMapServiceLayer for that service in your example.