I am relatively new to JavaScript and ArcGIS Implementation, so if I'm missing an overarching understanding please feel free to call me out on that...
I have a MapServer that I connect to that has about 30 different layers, and in the map I am making each layer can be set to toggled "On" or "Off". On top of this I would like to generate an InfoTemplate for each layer that is currently "On" (or checked). Rather than make each one a FeatureLayer, is there a way to programmatically do this, preferably for each currently active layer have a set of InfoTemplates that can be accessed through one popup.
map = new Map("map"); var dynamic = new ArcGISDynamicMapServiceLayer("http://gis1.acimap.us/projectservices/rest/services/BaseMaps/Topographic_BaseMap/MapServer"); map.addLayer(dynamic); layer = new ArcGISDynamicMapServiceLayer("http://gis1.acimap.us/projectservices/rest/services/GenAppRef/QueryLayers/MapServer"); // layer = new ArcGISDynamicMapServiceLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer"); layer.on("load", buildLayerList); map.addLayer(layer); function buildLayerList() { var items = arrayUtils.map(layer.layerInfos, function (info, index) { if (info.defaultVisibility) { visible.push(info.id); } return "" + info.name + "
"; }); var ll = dom.byId("layer_list"); ll.innerHTML = items.join(' '); layer.setVisibleLayers(visible); on(ll, "click", updateLayerVisibility); } function updateLayerVisibility() { var inputs = query(".list_item"); var input; visible = []; arrayUtils.forEach(inputs, function (input) { if (input.checked) { visible.push(input.id); } }); //if there aren't any layers visible set the array to be -1 if (visible.length === 0) { visible.push(-1); } layer.setVisibleLayers(visible); }
أكثر...
I have a MapServer that I connect to that has about 30 different layers, and in the map I am making each layer can be set to toggled "On" or "Off". On top of this I would like to generate an InfoTemplate for each layer that is currently "On" (or checked). Rather than make each one a FeatureLayer, is there a way to programmatically do this, preferably for each currently active layer have a set of InfoTemplates that can be accessed through one popup.
map = new Map("map"); var dynamic = new ArcGISDynamicMapServiceLayer("http://gis1.acimap.us/projectservices/rest/services/BaseMaps/Topographic_BaseMap/MapServer"); map.addLayer(dynamic); layer = new ArcGISDynamicMapServiceLayer("http://gis1.acimap.us/projectservices/rest/services/GenAppRef/QueryLayers/MapServer"); // layer = new ArcGISDynamicMapServiceLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer"); layer.on("load", buildLayerList); map.addLayer(layer); function buildLayerList() { var items = arrayUtils.map(layer.layerInfos, function (info, index) { if (info.defaultVisibility) { visible.push(info.id); } return "" + info.name + "
"; }); var ll = dom.byId("layer_list"); ll.innerHTML = items.join(' '); layer.setVisibleLayers(visible); on(ll, "click", updateLayerVisibility); } function updateLayerVisibility() { var inputs = query(".list_item"); var input; visible = []; arrayUtils.forEach(inputs, function (input) { if (input.checked) { visible.push(input.id); } }); //if there aren't any layers visible set the array to be -1 if (visible.length === 0) { visible.push(-1); } layer.setVisibleLayers(visible); }
أكثر...