Select to view content in your preferred language

IdentifyTask related

2791
3
07-11-2014 11:14 AM
BhavinSanghani
Frequent Contributor

I have requirements to show gis attributes of multiple points in one single popup. I explored IdentifyTask and it works fine if I have single map point to pass in. Let's say if I have multiple points on multiple layers then is there any support from JS API? I can probably use IdentifyTask in for loop and wait for all responses to come. But wondering if there is a better way. Also, I am not sure if IdentifyTask can work in this scenario, any example?

0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor

Do you mean multiple layers in one service or multiple services? If it's multiple layers in one service, than this sample shows you how to do that.

If it's multiple services, then yes, you will have to run the IdentifyTask over each service, but you can still put them all into one infoWindow. Take a look at this post that shows how to do that.

You should add the tag "javascript" to your post to make it more searchable on this forum.

0 Kudos
BhavinSanghani
Frequent Contributor

I meant for single service only. I checked that example and it is passing only one mappoint. I want to pass multiple mappoints. I am selecting multiple records from the grid and need to show attributes of all the selected record in tree view (as mentioned on the example). e.g. record1 is on (x1,y1) point and on layer1 but record2 is on (x2,y2) point and on layer2. I guess LAYER_OPTION_ALL will consider for all layers but probably there is no way to pass multiple points with IdentifyTask.

0 Kudos
BrandonVan_Horn
Regular Contributor

What I did was to build a separate function that uses the query task that loops through the graphics and the last map click to find the selected features, then build an array of the queries, pass that array to a promise, loop though the results and return it to the user.