How to perform identity results based on layer on/off

527
4
07-23-2013 09:57 PM
upendrapaladugu
New Contributor
Hi,
  
   How to perform identity results depend on layer toggle on/off?. We are using display layers and identity layers are different but layer class is same, identity layers are not visible and we used updateLayerVisibility for layer on/off.

Any suggestions would be appreciated..


Thanks
Upendra
0 Kudos
4 Replies
KenBuja
MVP Esteemed Contributor
What you'll have to do is set the the layerIds property of the IdentifyParameters to the visibleLayers of your layer.

identifyParams.layerIds = layerDynamic.visibleLayers;
0 Kudos
DianaBenedict
Occasional Contributor III
What you'll have to do is set the the layerIds property of the IdentifyParameters to the visibleLayers of your layer.

identifyParams.layerIds = layerDynamic.visibleLayers;


Ken
I like what you did there. I do have a question though. I see that the IdentifyParamater object has a layerOption property where you can set the constant value to LAYER_OPTION_VISIBLE .   Is is also possible to set all the layers of interest in your initial layerIds and then set the layerOption to LAYER_OPTION_VISIBLE?  Is this slower then just reseting the layerIds to the visibleLayers?  

This is purely an academic question. Either way, I will definately keep the answer that you suggested in mind as well.
0 Kudos
BetsySchenck-Gardner
Occasional Contributor
Assuming you are using checkboxes to toggle on/off your layers, you can monitor where the checkbox's value is true. Then in the returned results of an identify if your layer has been toggled on and you actually have a result for that layer, values will be written out. I've used this approach with tabbed infowindows. You might be clicking on a location on the map that you don't have any data but the layer has been set to be visible. Your results for that layer will be 0 but the tab would still show up in your tabbed infowindow. Using the approach I just described will make sure you won't get that tab if there are no results.
0 Kudos
KenBuja
MVP Esteemed Contributor
Betsy,

I'm using an infoWindow with a TabContainer to show the results of an IdentifyTask, but I've never run into an issue where clicking on a location with no data in a visible layer will return a tab with no results. That's shown in this Fiddle.
0 Kudos