Last active
January 1, 2018 22:59
-
-
Save geog4046instructor/0f53749488274a1796d2 to your computer and use it in GitHub Desktop.
ArcGIS JavaScript API - add a layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add layer(s) from an ArcGIS web service | |
* | |
* function name: ArcGISDynamicMapServiceLayer | |
* module name: "esri/layers/ArcGISDynamicMapServiceLayer" | |
* documentation: https://developers.arcgis.com/javascript/jssamples/map_dynamic.html | |
* example: http://developers.arcgis.com/javascript/samples/map_dynamic/ | |
*/ | |
// Create a layer object from an ArcGIS Server web service, with no options | |
let layer1 = new ArcGISDynamicMapServiceLayer( "http://example.com/arcgis/rest/services/Layer1/MapServer" ); | |
map.addLayer(layer1); // add the layer object to the map | |
// Create a layer object from an ArcGIS Server web service, setting the opacity option | |
let layer2 = new ArcGISDynamicMapServiceLayer( "http://example.com/arcgis/rest/services/Layer2/MapServer", { | |
"opacity": 0.35 | |
}); | |
map.addLayer(layer2); // add the layer object to the map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment