I want to use javascript and dojo to add and remove layers.
Tell me more
×
Geographic Information Systems Stack Exchange is a question and answer site for
cartographers, geographers and GIS professionals. It's 100% free, no registration required.
|
Use esri.Map's addLayer and removeLayer methods. Both take the layer to add or remove from the map as an argument. You might also be interested in map.removeAllLayers() and map.reorderLayer. Finally, one thing that sometimes trips people up is getting a reference to layers in the map. The recommended approach is to assign an ID to your layers when you create them. If you don't manually assign an ID, the map assigns one for you. You can get these id's by looking at map.layerIds and map.graphicsLayerIds. Both are arrays of strings. Once you have an ID, get the associated layer using map.getLayer("some_layer_id"). |
|||||||||
|
