IdentifyTask with multi Polygons as geometry input

589
4
Jump to solution
05-11-2012 07:03 AM
AdrianMarsden
Occasional Contributor III
As title really - I am trying to run an automated search.  An input ref is passed to the map service - this finds existing features.  It adds these as graphic layers using Find Task.  If only one feature is found, this is passed to a Identify Task that searches loads of other layers.  This all works for a single polygon, but not for multi polygons - The features in the original layer (the one that gets searched with the Find Task) are NOT multi polygon features polygons, but multiple records with the same reference (not my design - I'm hacking into another system)

Any ideas?

ACM
0 Kudos
1 Solution

Accepted Solutions
ThaoLe
by
New Contributor III
You can do this by calling multiple IdentifyTasks. Here's one workflow you may follow:

1. Create an IdentifyTask that performs the identify for one geometry
2. After the results are returned, store the results in a global variable
3. Within the same result event, call the second IdentifyTask
4. In the results for the second IdentifyTask, store the results into the same global variable as the first IdentifyTask
5. Repeat this as many times as you want

Once you've completed all the IdentifyTasks, loop through all the results in the global variable. You should now have all the results from all the IdentifyTasks that you ran.

Hope this helps!

View solution in original post

0 Kudos
4 Replies
ThaoLe
by
New Contributor III
You can do this by calling multiple IdentifyTasks. Here's one workflow you may follow:

1. Create an IdentifyTask that performs the identify for one geometry
2. After the results are returned, store the results in a global variable
3. Within the same result event, call the second IdentifyTask
4. In the results for the second IdentifyTask, store the results into the same global variable as the first IdentifyTask
5. Repeat this as many times as you want

Once you've completed all the IdentifyTasks, loop through all the results in the global variable. You should now have all the results from all the IdentifyTasks that you ran.

Hope this helps!
0 Kudos
derekswingley1
Frequent Contributor
If you want to use multiple features as the geometry for an identify task, I would send them off to a geometry service's union operation and use the result of that as your identifyParameters.geometry parameter.
0 Kudos
ThaoLe
by
New Contributor III
If you want to use multiple features as the geometry for an identify task, I would send them off to a geometry service's union operation and use the result of that as your identifyParameters.geometry parameter.


This is an even better idea!
0 Kudos
AdrianMarsden
Occasional Contributor III
Thanks for that - after posting I had a quick go at the loop/multiple Id tasks and it did what I wanted without too much hacking of the code.  I need to include a bit of logic to exclude duplicate answers - I'll remember the other way for next time.
0 Kudos