[GIS] Info (data from fields) from multiple overlapping features in popup element in ArcGIS JavaScript API

arcgis-javascript-api

I'm just trying to do a simple task. I have a point file with numerous overlapping points. When I load the service onto ArcGIS.com (their online mapping site) and enable popups and click on a point that is lying on top of other points, it gives me a popup, and gives me a little back and forward arrow to run through each of the points selected through my click.

You can sort of see it here in the image: https://developers.arcgis.com/en/javascript/jshelp/intro_popuptemplate.html

The image on the right hand side of that page shows (1 of 2) in the popup window title element.

The way my selection is done is by simply adding to the layers as a featureclass to my dojo map element.

So basically, what my question is, how do I enable and do this? Where when I click on a point with underlying points, the popup allows me to view those as well (instead of the point that's just on top).

Thanks

Best Answer

Are you looking at getting the results back from several different layers that you've added? If so, this Fiddle shows how to do that. As each the layer is added to the map, an IdentityTask is created for that layer. When you click on the map, all the IdentifyTasks will be run and the popup window will contain all the features found in the different layers.

Here's another Fiddle that does something similar, but shows how to do it with two layers that can be turned on or off.

Related Question