ArcGIS Api for Js基础
1、创建ArcGISDynamicMapServiceLayer
var demographicsLayerURL = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer"; var demographicsLayerOptions = { "id": "demographicsLayer", "opacity": 0.8, "showAttribution": false }; var demographicsLayer = new ArcGISDynamicMapServiceLayer(demographicsLayerURL, demographicsLayerOptions); demographicsLayer.setInfoTemplates({ 1: { infoTemplate: _blockGroupInfoTemplate }, 2: { infoTemplate: _countyCensusInfoTemplate } }); demographicsLayer.setVisibleLayers([1, 2]); map.addLayer(demographicsLayer); var oilAndGasLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/MapServer", { "id": "oilAndGasLayer", "opacity": 0.75 }); oilAndGasLayer.setInfoTemplates({ 0: { infoTemplate: _oilAndGasInfoTemplate } }); map.addLayer(oilAndGasLayer);
2、创建Map
map = new Map("ui-esri-map", { basemap: "topo", center: [-94.75290067627297, 39.034671990514816], // long, lat zoom: 12, sliderStyle: "small", infoWindow: popup });