Identify only visible features (layerdefinition)

688
3
12-02-2011 09:57 AM
MikeKillion
New Contributor II
Hello,
I'm using a layer definition to display only a subset of features. When I then click on a point to identify it however, it frequently brings up a nearby 'invisible' feature - one that was excluded by the layer definition.

I've read this thread: http://forums.arcgis.com/threads/39250-Identify-Task-identifys-also-invisble-features-(LayerDefiniti... but am still having no luck.

Anybody have an example of applying the identifyparams.layerdefinitions that is more complete than the reference snippet? Or another method of identifying only visible features?

Thanks
0 Kudos
3 Replies
StephenLead
Regular Contributor III
Hi Mike,

I haven't tried this but from the documentation it seems you need to apply the same layer definition to the IdentifyParameters as you apply to the layer.

Can you post the code showing how you're applying the definition to your layer? It should then be possible to recommend how to do it in the IdentifyParameters.

Steve
0 Kudos
RahulMetangale
New Contributor
You have to first set idParams.layerDefinitions to an empty array and then populate the array. Each item in that array corresponds to a single layer definition. An item's index in an array corresponds to the layer index to which a layer definition applies.
The simplest way to use layer definitions on an identifyParameters object while still having readable code is the following:
// create layerDefinitions as an empty array
idParams.layerDefinitions = [];
// populate only the array indexes which need to apply a definition query
idParams.layerDefinitions[2] = "PSTLADDRESS = '4686 Brightmore Rd'"
0 Kudos
SantiagoLastra
New Contributor
Hi, Rahul
Is this also applicable to ArcGIS Server 9.3.1? I tried with your sample servers and it worked, but with my 9.3.1 ArcGIS Server I couldn't make it work.
Is there any alternative?
Thanks in advance,
Santiago
0 Kudos