What is the reason for using both layerids and layer_option_all in identifyparams?

727
3
05-24-2012 05:56 AM
MikeOnzay
Occasional Contributor III
In the identify sample http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm, the code shows using both specific layerids and the option to use all. It seems like it should be one or the other.

identifyParams.layerIds = [0,2];
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
0 Kudos
3 Replies
KellyHutchins
Esri Frequent Contributor
Sounds like a bug/typo in the sample. The default value for layerOption is that only the top-most visible layer is identified. So the sample should probably specify the visible layers and set the layerOption to LAYER_OPTION_VISIBLE instead of all.
0 Kudos
MikeOnzay
Occasional Contributor III
Sounds like a bug/typo in the sample. The default value for layerOption is that only the top-most visible layer is identified. So the sample should probably specify the visible layers and set the layerOption to LAYER_OPTION_VISIBLE instead of all.


I'm still not clear as to whether both parameters should be included or not. The API says that by specifying layerids then only those layers will be identified. It doesn't say anything about whether the layers are visible or not. Whereas the layer_option parameter is about visibility.
0 Kudos
MikeOnzay
Occasional Contributor III
I'm still not clear as to whether both parameters should be included or not. The API says that by specifying layerids then only those layers will be identified. It doesn't say anything about whether the layers are visible or not. Whereas the layer_option parameter is about visibility.


I discovered that it does help to use both the layerids and layer_option_all. In my particular application I was identifying two featurelayers from one mapservice. An identify operation was only returning the results from one layer even though I specified both layers in identifyParams.layerIds = [3,4] and I knew that it should be picking up a feature from the second layer; When I added identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; the results from both layers came back.

So, the sample from the original posting may be correct, and all that might be needed is a clearer explanation of how these two parameters work together.
0 Kudos