Setting the visible layers from a map service
You can control the visibility of individual layers within a dynamic map service layer using the setVisibleLayers() method. This only applies to dynamic map service layers, not tiled map service layers. This method takes an array of integers corresponding to the data layers in the map service. This array is zero-based so the first layer in the map service occupies position 0. In the Demographics map service illustrated in the following screenshot, Demographics/ESRI_Census_USA (0) occupies index 0:

Therefore, in the event that we'd like to display only the Census Block Points and Census Block Groups from this service we could use setVisibleLayers() as seen in the code example as follows:
var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com
/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"); dynamicMapServiceLayer.setVisibleLayers([0,1]); map.addLayer(dynamicMapServiceLayer);
推薦閱讀
- Vue.js設(shè)計(jì)與實(shí)現(xiàn)
- 從零構(gòu)建知識(shí)圖譜:技術(shù)、方法與案例
- Fundamentals of Linux
- ThinkPHP 5實(shí)戰(zhàn)
- 深入淺出Electron:原理、工程與實(shí)踐
- Learning Data Mining with Python
- Magento 2 Theme Design(Second Edition)
- Raspberry Pi for Secret Agents(Third Edition)
- 跟老齊學(xué)Python:輕松入門
- Internet of Things with Intel Galileo
- Monitoring Elasticsearch
- C++程序設(shè)計(jì)基礎(chǔ)教程
- PhoneGap:Beginner's Guide(Third Edition)
- Vue.js 2 Web Development Projects
- JSP程序設(shè)計(jì)實(shí)例教程(第2版)