In the ESRI JavaScript API 3.x, is there any way to get Feature Layers from a WebMap?, if yes, could someone show me a sample code?

536
2
10-03-2017 06:49 AM
MarvinOconitrillo
New Contributor III

I need to get some feature layers from a Web Map I created, using the ESRI JavaScript 3.x (it could be in any version while it's on the 3)

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Marvin,

  It is as simple as:

var myLayer = map.getLayer("USA_Tapestry_335");
diaconori
New Contributor III

Do you have to hard-code the value? Isn't it possible to just do something like:

var activeLayers = this.map.getLayers();
// process layers in a for-each loop or similar... 

 

0 Kudos