Adding layers to the map
The Map.addLayer() method takes an instance of a layer (ArcGISDynamicMapServiceLayer or ArcGISTiledMapServiceLayer in our examples) as the first parameter, and an optional index that specifies where it should be placed. If you don't specify an index, the layer will be placed on top of all the other layers in the map, which is often what you want so that you can be sure it is visible.
In the following code example we create a new instance of ArcGISDynamicMapServiceLayer. We then call Map.addLayer(), passing in the new instance of the layer. The layers in the service will now be visible on the map:
var operationalLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer"); map.addLayer(operationalLayer);
If you want to add more than one layer to the map in one go, you can use Map.addLayers(), which accepts an array of layer objects.
As well as being able to add layers to a map you can also remove them by using Map.removeLayer(layer) or Map.removeAllLayers().
- Unreal Engine Physics Essentials
- 摩登創客:與智能手機和平板電腦共舞
- Hands-On Data Structures and Algorithms with JavaScript
- C/C++常用算法手冊(第3版)
- Ray分布式機器學習:利用Ray進行大模型的數據處理、訓練、推理和部署
- MySQL從入門到精通(軟件開發視頻大講堂)
- Learning Continuous Integration with TeamCity
- PHP 7從零基礎到項目實戰
- NGUI for Unity
- Julia High Performance(Second Edition)
- Python應用與實戰
- Java面試一戰到底(基礎卷)
- Learning Dynamics NAV Patterns
- Mastering PostgreSQL 11(Second Edition)
- Lync Server Cookbook