转自原文arcgis for javascript 添加featurelayer,设置地图最大最小等级
var map; var livingCenter; var livingCenterUrl = "http://172.31.170.98:6080/arcgis/rest/services/livingcenter/FeatureServer/0"; var featureLayer; var featureLayerUrl = "http://172.31.170.98:6080/arcgis/rest/services/layer_living/FeatureServer/0"; map = new Map("map", { center: [122.12, 37.48], zoom: 7, maxZoom:11,//最大空间等级 minZoom:6,//最小空间等级 slider:false,//隐藏比例尺控件 logo:false,//隐藏logo basemap: "shiliang", height:"100%" }); featureLayer = new FeatureLayer(featureLayerUrl, { id : "featureLayer", mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"] }); featureLayer.setOpacity(0.6); livingCenter = new FeatureLayer(livingCenterUrl,{ id : "livingCenter", mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"] }); map.addLayers([featureLayer,livingCenter]);