<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic selectFeatures only returning &amp;amp;amp;quot;top&amp;amp;amp;quot; feature of overlapping features in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528944#M49334</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I have the selectFeatures return all features at that location, not just the one? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;dojo.connect(map, "onClick", function (evt) { &amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query(); &amp;nbsp;&amp;nbsp;&amp;nbsp; query.geometry = pointToExtent(map, evt.mapPoint, 10); //buffers click point by number of pixels(10)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var deferred = featureLayerSeg.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW); &amp;nbsp;&amp;nbsp;&amp;nbsp; deferred.addCallback(function (features) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(features.length); //this returns 1 if the features are stacked on top of each other &amp;nbsp;&amp;nbsp;&amp;nbsp; }); }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Mar 2012 15:22:56 GMT</pubDate>
    <dc:creator>ChadWilcomb</dc:creator>
    <dc:date>2012-03-19T15:22:56Z</dc:date>
    <item>
      <title>selectFeatures only returning &amp;amp;quot;top&amp;amp;quot; feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528944#M49334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I have the selectFeatures return all features at that location, not just the one? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;dojo.connect(map, "onClick", function (evt) { &amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query(); &amp;nbsp;&amp;nbsp;&amp;nbsp; query.geometry = pointToExtent(map, evt.mapPoint, 10); //buffers click point by number of pixels(10)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var deferred = featureLayerSeg.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW); &amp;nbsp;&amp;nbsp;&amp;nbsp; deferred.addCallback(function (features) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(features.length); //this returns 1 if the features are stacked on top of each other &amp;nbsp;&amp;nbsp;&amp;nbsp; }); }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2012 15:22:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528944#M49334</guid>
      <dc:creator>ChadWilcomb</dc:creator>
      <dc:date>2012-03-19T15:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: selectFeatures only returning "top" feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528945#M49335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you using on_demand mode for your feature layer? if so auto-generalize is true by default.&amp;nbsp; I wonder if this is interfering with your selection.&amp;nbsp; Try setting auto-generalize to false.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;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.&lt;BR /&gt;&lt;BR /&gt;How can I have the selectFeatures return all features at that location, not just the one? &lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(map, "onClick", function (evt) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.geometry = pointToExtent(map, evt.mapPoint, 10); //buffers click point by number of pixels(10)

&amp;nbsp;&amp;nbsp;&amp;nbsp; var deferred = featureLayerSeg.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);
&amp;nbsp;&amp;nbsp;&amp;nbsp; deferred.addCallback(function (features) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(features.length); //this returns 1 if the features are stacked on top of each other
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;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.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:01:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528945#M49335</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2021-12-11T23:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: selectFeatures only returning "top" feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528946#M49336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jeff, thanks for your response. That seems like it would cause the same result I am seeing. However, I am using SNAPSHOT mode. I tried using .setAutoGeneralize(false) on my FeatureLayer before applying the setDefinitionExpression but it didn't make any difference.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2012 18:23:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528946#M49336</guid>
      <dc:creator>ChadWilcomb</dc:creator>
      <dc:date>2012-03-19T18:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: selectFeatures only returning "top" feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528947#M49337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Jeff, thanks for your response. That seems like it would cause the same result I am seeing. However, I am using SNAPSHOT mode. I tried using .setAutoGeneralize(false) on my FeatureLayer before applying the setDefinitionExpression but it didn't make any difference.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes snapshot mode kinda rules that out. Can you try two things?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Identify in the mxd.&amp;nbsp; Make sure its really there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Run a geometry query on the rest service .&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If both of those return the multiple overlapping results, you may have found a bug in the feature layer.&amp;nbsp; You could also try switching to on_demand mode and disabling autogeneralize also just for troubleshooting.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2012 18:32:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528947#M49337</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2012-03-19T18:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: selectFeatures only returning "top" feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528948#M49338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff, those were good suggestions. I have confirmed that the features are there in the MXD. A query on the REST service using the same extents from my mouse click returns the 10 features that I expect to get from selectFeatures. I can see the JSON returned from the original feature request with the 10 features as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I look at the one feature that is returned from the following code in the Console, I see it has a _count property that is always the number of features I expect to get +1. I can't really explain why it has the +1, but other than that it is correct (ie- if I click on a segment that should have 10 features, _count = 11, if it should have 1 feature, _count = 2) I have attached a screenshot of Firebug Console showing the feature object returned by the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var deferred = featureLayerSeg.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; deferred.addCallback(function (features) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(features.length);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(var i=0; i &amp;lt; features.length; i++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(features&lt;I&gt;); //returns only one feature to Console- see attached screenshot
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for your suggestions, much appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]12825[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:01:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528948#M49338</guid>
      <dc:creator>ChadWilcomb</dc:creator>
      <dc:date>2021-12-11T23:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: selectFeatures only returning "top" feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528949#M49339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Oh, I also tried MODE_ONDEMAND with setAutoGeneralize(false) but that gave the same results. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, this property gives me the correct number of features: _graphicsLayer._counter.value but I still don't see the attributes of all 6 features anywhere in the object.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2012 20:43:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528949#M49339</guid>
      <dc:creator>ChadWilcomb</dc:creator>
      <dc:date>2012-03-19T20:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: selectFeatures only returning "top" feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528950#M49340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm able to get this to work. More info:&amp;nbsp; &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://gis.stackexchange.com/a/22098/124" rel="nofollow" target="_blank"&gt;http://gis.stackexchange.com/a/22098/124&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 21:22:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528950#M49340</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-03-21T21:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: selectFeatures only returning "top" feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528951#M49341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I'm able to get this to work. More info:&amp;nbsp; &lt;A href="http://gis.stackexchange.com/a/22098/124"&gt;http://gis.stackexchange.com/a/22098/124&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Useful?&lt;/SPAN&gt;&lt;IMG src="http://www.infoocean.info/avatar2.jpg" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 00:47:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528951#M49341</guid>
      <dc:creator>ConstanceDavisson</dc:creator>
      <dc:date>2012-03-22T00:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: selectFeatures only returning "top" feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528952#M49342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Useful?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Care you to elaborate? I don't follow...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 02:14:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528952#M49342</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-03-22T02:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: selectFeatures only returning "top" feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528953#M49343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I'm able to get this to work. More info:&amp;nbsp; &lt;A href="http://gis.stackexchange.com/a/22098/124"&gt;http://gis.stackexchange.com/a/22098/124&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 18:37:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528953#M49343</guid>
      <dc:creator>ChadWilcomb</dc:creator>
      <dc:date>2012-03-23T18:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: selectFeatures only returning "top" feature of overlapping features</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528954#M49344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;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).&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nice! Thanks for following up.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 18:41:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selectfeatures-only-returning-amp-amp-quot-top-amp/m-p/528954#M49344</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-03-23T18:41:16Z</dc:date>
    </item>
  </channel>
</rss>

