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);
推薦閱讀
- INSTANT Mock Testing with PowerMock
- Mastering Concurrency Programming with Java 8
- Moodle Administration Essentials
- Getting started with Google Guava
- 動手玩轉Scratch3.0編程:人工智能科創教育指南
- C語言程序設計教程(第2版)
- 小程序開發原理與實戰
- Learning ArcGIS for Desktop
- C++從入門到精通(第5版)
- Getting Started with React Native
- 精通MySQL 8(視頻教學版)
- H5+移動營銷設計寶典
- 你真的會寫代碼嗎
- 你好!Java
- 算法精解:C語言描述