Select to view content in your preferred language

selectFeatures only returning "top" feature of overlapping features

1957
10
Jump to solution
03-19-2012 08:22 AM
ChadWilcomb
Deactivated User
I am using the selectFeatures function to launch a popup when clicking on a feature. Because of the nature of my data, many of the features (street segments) have coincident geometry (they are stacked on top of each other). When I click on one of these segments that I know has multiple coincident features, the selectFeatures function only returns one feature (assuming the "top" one). If the features are adjacent (within my 10 pixel click buffer) but not coincident, it returns multiple features.

How can I have the selectFeatures return all features at that location, not just the one?

dojo.connect(map, "onClick", function (evt) {     var query = new esri.tasks.Query();     query.geometry = pointToExtent(map, evt.mapPoint, 10); //buffers click point by number of pixels(10)      var deferred = featureLayerSeg.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);     deferred.addCallback(function (features) {          console.log(features.length); //this returns 1 if the features are stacked on top of each other     }); }


PS- I don't want to use IdentifyTask to a map service because these feature layers have already been filtered by the user based on search parameters.
0 Kudos
10 Replies
derekswingley1
Deactivated User
Thanks again Derek! The OBJECTID field in my map service was not unique. Once I fixed that issue, the selectFeatures is behaving as expected (returning multiple features).


Nice! Thanks for following up.
0 Kudos