Select to view content in your preferred language

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?

722
2
10-03-2017 06:49 AM
MarvinOconitrillo
Occasional Contributor

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
Occasional Contributor

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