Hi,
I have a dynamic map layer but for some reason once the widget update the variable "year_opSelect" which changes the url to a different map service, the popup stopped working. does anyone know why and how to fix it? Thanks so much!!
takeoutLayerFromMap: function (layer) {
this.inherited(arguments);
var layerToRemove = this.map.getLayer(layer);
this.map.removeLayer(layerToRemove);
},
if (this.map.getLayer("hDynamicLayer") !== undefined) {
this.takeoutLayerFromMap("hDynamicLayer");
};
var hYearUrlD = "https://randomtestsite.org:6443/arcgis/rest/services/appLayers/Application_" + year_opSelect + "/MapServer"
var hDynTemplate= {};
hDynTemplate[0] = { infoTemplate: templateX };
var hDynamicLayer = new ArcGISDynamicMapServiceLayer(hYearUrlD, {id: "hDynamicLayer", minScale: hDetailMinVal, imageformat: "png32", name: "h Application Details"});
hDynamicLayer.setVisibleLayers([dSelect]);
hDynamicLayer.setInfoTemplates(hDynTemplate);
var hLayerDefinitions = [];
hLayerDefinitions[dSelect] = hYear_ID;
var hlayerDrawingOptions = [];
var layerDrawingOption = new LayerDrawingOptions();
layerDrawingOption.renderer = hRenderer;
hlayerDrawingOptions[dSelect] = layerDrawingOption;
hDynamicLayer.setLayerDrawingOptions(hlayerDrawingOptions);
hDynamicLayer.setLayerDefinitions(hLayerDefinitions);
this.map.addLayer(hDynamicLayer);
Ran, are you removing the previous layer that had the same ID?..
Hi Robert,
Yes, I have a function that takes out the layer at the beginning. but strangely the layer get added without any issue, just the pop up not won't show. but as soon as i switch back to the initial url. it works right the way. any idea? Thanks!!
takeoutLayerFromMap: function (layer) {
this.inherited(arguments);
var layerToRemove = this.map.getLayer(layer);
this.map.removeLayer(layerToRemove);
},
if (this.map.getLayer("hDynamicLayer") !== undefined) {
this.removeLayerFromMap("hDynamicLayer");
};
Thanks,
Ryan
Ryan,
Is it just a misspelling or why do you have
this.removeLayerFromMap("hDynamicLayer"); and your function is called takeoutLayerFromMap?
Hi Robert,
good catch, it's the same function. I copied and pasted but didn't copy the remove part and type in the wrong name.
Thanks,
Ryan
Ryan,
So do each of your layers you are using have the same schema (meaning the same field names)? On each of the map services is it always going to be layer 1 that gets that infotemplate?
Robert,
yes, they do, same fields and it's always layer 0.
Ryan,
Hmm. I don't see the issue. The field names have no variation at all right (cAsE of the names or anything)?
Robert,
yes, that's what strange to me. the layer services have identical field names. (all lower case)