//create layer parameters based on JSON var params = { id: item.id, visibility: item.visibility || true, opacity: item.opacity || 1, visibleLayers: item.visibleLayers || ["*"] }; //create new dynamic layer based on JSON var addingLayer = new esri.layers.ArcGISDynamicMapServiceLayer(item.url, params); //title so that it gets added to custom TOC addingLayer.title = item.title; //Add the new layer this.map.addLayer(addingLayer); //Add the popups for the individual feature layers of the mapservice if (item.layers) { for (var j = 0; j < item.layers.length; j++) { //create popup using popupinfo object already existing in JSON file var pop = new esri.dijit.PopupTemplate(item.layers.popupInfo); //create the feature layer and apply the popup template var fL = new esri.layers.FeatureLayer(item.url + "/" + item.layers.id, { mode: 2, layerId: item.layers.id, id: item.id + "_" + item.layers.id, infoTemplate: pop, outFields: ["*"] }); this.map.addLayer(fL); } };
if (layer.serviceInfo) { for (var j = 0; j < layer.serviceInfo.layers.length; j++) { //create popup using popupinfo object already existing in JSON file var popupTemplateStore = new Memory({ idProperty: "ID", data: json.parse(popupTemplate) }); var TemplatefromJson = popupTemplateStore.get(layer.serviceInfo.layers.id); var PopupTemplate = new esri.dijit.PopupTemplate({ title: TemplatefromJson.popupInfo.title, fieldInfos: TemplatefromJson.popupInfo.fieldInfos, showAttachments: TemplatefromJson.popupInfo.showAttachments, description: TemplatefromJson.popupInfo.description, mediaInfos: TemplatefromJson.popupInfo.mediaInfos }) //create the feature layer and apply the popup template var fL = new esri.layers.FeatureLayer(item.url + "/" + layer.serviceInfo.layers.id, { mode: 2, layerId: layer.serviceInfo.layers.id, id: item.id + "_" + layer.serviceInfo.layers.id, infoTemplate: PopupTemplate, outFields: ["*"] }); this.map.addLayer(fL); } };
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.