arcgis api for js之setVisibleLayers(设置动态地图服务中图层的显隐)

require([
  "esri/layers/ArcGISDynamicMapServiceLayer"  
], function(ArcGISDynamicMapServiceLayer ) {
  var layer = new ArcGISDynamicMapServiceLayer(url);//url=xx/xx/MapServer为动态地图服务, MapServer中有若干个图层,0,1,2,...n
  var visible = [];
  visible.push(id);//id为动态地图服务中的图层id,如0,1,2,3,...,n图层
  layer.setVisibleLayers(visible);
  map.addLayer(layer);
});

 

你可能感兴趣的:(arcgis,api,for,js)