官术网_书友最值得收藏!

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);
主站蜘蛛池模板: 德格县| 普格县| 湟源县| 和林格尔县| 新河县| 浦县| 淮南市| 运城市| 鲁甸县| 江西省| 都兰县| 二连浩特市| 永仁县| 梨树县| 稻城县| 芦溪县| 五峰| 平定县| 卢氏县| 普兰县| 五台县| 安福县| 重庆市| 云南省| 邮箱| 运城市| 原平市| 静海县| 柳河县| 滦平县| 台山市| 加查县| 蒲城县| 松滋市| 瑞金市| 乐亭县| 扎囊县| 舞阳县| 扬州市| 陈巴尔虎旗| 枣强县|