Select to view content in your preferred language

Spatial Query vs Identify to obtain attribute info

710
4
05-31-2010 09:32 AM
TylerMunn
Emerging Contributor
I am trying to write some code right now to obtain attribute information from either a point, line, or polygon. The field will have the same name for each feature. The value from that field will then be passed on elsewhere.

Would either Identify or a Spatial Query work in my case? I am modifying some code but am running into a few issues due to lack of experience. I have identify mostly working right now, but is it possible to isolate one field and pass that value onto a variable? I do not need to display any of the information.

Thank you
0 Kudos
4 Replies
TylerMunn
Emerging Contributor
I have a feeling it may not be the best solution, but for now I have something temporarily working.

I am able to obtain the result value of the first field after OBJECT_ID & SHAPE, which works as I will only have one more ID field in the attribute table.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Some other possible options:

1) Use the DisplayFieldName (class IdentifyResult), which likely is the field you want to display.

2) Use the userToken (optional second argument of ExecuteAsync) to store your field name. On the event ExecuteCompleted, you will get back the field name as UserState of the identifyEventArgs.

3) Define your own handler for the event ExecuteCompleted and add the field name as argument of this handler.
0 Kudos
TylerMunn
Emerging Contributor
Thanks Dominique,

I realize what I was doing was just displaying the field value from the attribute table that was set to Primary Display Field, and as a result, I've run into more problems.

Does the identify task have a way to take data from pre-chosen fields, like query outfield does? I will have overlapping polygons/points/lines, so when the user identifies, I want a box to come up with a list with all identified and only certain fields to have their data displayed.

ID number + polygon type ...for example

Another option I have considered is using the Identify example with US states and the dropdown box. Is it possible to hide certain fields? If I select turn field off in the attribute table, would that hide it in the data grid? I want to have a URL field that I access the url as a variable from, and keep it hidden but linked to some text.

Perhaps your suggestion of "3) Define your own handler for the event ExecuteCompleted and add the field name as argument of this handler." would work but I am not much of a programmer and am learning by exmaples at this point.

Thanks for anyones help.
0 Kudos
TylerMunn
Emerging Contributor
Well after a lot of playing around I was able to figure some things out.

Turning off the fields in the MXD will hide them from being displayed with the identify task. I am not able to hide the URL field currently but have modified some code to get it to perform as I want for the most part.
0 Kudos