I've searched the forums, but can't find anything recent regarding this topic. Is there an easy/convenient way to filter the identifyTask by layers that are toggled on or off in the Table of Contents?
Thanks in advance.
Just set the layerOption method of the IdentifyParameters to IdentifyParameters.LAYER_OPTION_VISIBLE. This might be overkill, but I also set the layerIds option to the visibleLayers of the layer I'm running the task on.
var idParams = new IdentifyParameters();idParams.width = map.width;idParams.height = map.height;idParams.geometry = evt.mapPoint;idParams.mapExtent = map.extent;idParams.layerOption = IdentifyParameters.LAYER_OPTION_VISIBLE;idParams.layerIds = layer.visibleLayers;idParams.tolerance = 3;idParams.returnGeometry = true;idParams.spatialReference = map.spatialReference;
Thanks, and I apologize if I am using the incorrect terminology. I want to be able to toggle visibility on and off within the application and only identify those layers which are currently toggled on.
That's what I do in my application. Here's one version of it: NCCOS BIOmapper Notice as you turn on different layers, only those will be shown in the popup window IdentifyTask.
Thank you. I ended up writing a new function that fires when the layer check box changes state. The function then updates an array, which is then passed on to the identify function to limit the layers identified to only those which are toggled on (checkbox is checked).
Thanks again for your help!
Retrieving data ...