<?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 Intersection is not accurate in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersection-is-not-accurate/m-p/1405817#M84227</link>
    <description>&lt;P&gt;Dear ESRI,&lt;/P&gt;&lt;P&gt;we built an application in Javascript where we are selecting a bunch of points on the ESRI map and retrieving selected points through the intersection with the graphic layer in the following way:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;                        sketchViewModel.on("create", (event) =&amp;gt; {
                            if (event.state === "complete") {
                                const extent = event.graphic.geometry.extent;
                                const intersection = graphicsLayer.graphics.filter((graphic) =&amp;gt;
                                    extent.intersects(graphic.geometry)
                                );
                                console.log("Items", intersection._items)
                                graphicsLayer.remove(event.graphic);
                                that.fireEvent("select", { event: intersection._items });
                            }
                        })&lt;/LI-CODE&gt;&lt;P&gt;However, we noticed a strange behavior. We want to select all the points on a given street. If we proceed by selecting small blocks very close to the points, the process works fine, but if we select all the points together the intersection seems to take more points than requested, probably involving also the nearest points.&lt;/P&gt;&lt;P&gt;Look at this case. First we select 3 points&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-42-08.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100047i84D8CAB3F2612143/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-42-08.png" alt="2024-04-03_09-42-08.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and all seems fine:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-43-43.png" style="width: 960px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100051iBC0991A0F3AE8DCF/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-43-43.png" alt="2024-04-03_09-43-43.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Three points are selected correctly. In the console you see 4 because one is always junk and not used.&lt;/P&gt;&lt;P&gt;Then we take 4 other points on the same street:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-45-46.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100053iEEA88340C2A5193D/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-45-46.png" alt="2024-04-03_09-45-46.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Even in this case the result is correct:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-46-11.png" style="width: 980px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100054iC822446D0046CDF3/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-46-11.png" alt="2024-04-03_09-46-11.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(One point is always junk and not used)&lt;/P&gt;&lt;P&gt;Finally, we select the remaining 2 points&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-48-01.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100056i26913974D9F46668/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-48-01.png" alt="2024-04-03_09-48-01.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and in this case too, all is correct.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-48-22.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100058i96A67EF5AC524082/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-48-22.png" alt="2024-04-03_09-48-22.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So, in total, I've selected 9 points (consider that for each selection one is always dummy)&lt;/P&gt;&lt;P&gt;But, if select all the points together using a segmented line&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-49-22.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100059i0B745E86CF890F1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-49-22.png" alt="2024-04-03_09-49-22.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;it brings me more than the ones I selected&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-50-03.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100061iB859BAAC8B5914DC/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-50-03.png" alt="2024-04-03_09-50-03.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;How can I fix this strange behavior? Why it's not so accurate when I extract the selected points?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 04 Apr 2024 15:33:20 GMT</pubDate>
    <dc:creator>AndreaRosati</dc:creator>
    <dc:date>2024-04-04T15:33:20Z</dc:date>
    <item>
      <title>Intersection is not accurate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersection-is-not-accurate/m-p/1405817#M84227</link>
      <description>&lt;P&gt;Dear ESRI,&lt;/P&gt;&lt;P&gt;we built an application in Javascript where we are selecting a bunch of points on the ESRI map and retrieving selected points through the intersection with the graphic layer in the following way:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;                        sketchViewModel.on("create", (event) =&amp;gt; {
                            if (event.state === "complete") {
                                const extent = event.graphic.geometry.extent;
                                const intersection = graphicsLayer.graphics.filter((graphic) =&amp;gt;
                                    extent.intersects(graphic.geometry)
                                );
                                console.log("Items", intersection._items)
                                graphicsLayer.remove(event.graphic);
                                that.fireEvent("select", { event: intersection._items });
                            }
                        })&lt;/LI-CODE&gt;&lt;P&gt;However, we noticed a strange behavior. We want to select all the points on a given street. If we proceed by selecting small blocks very close to the points, the process works fine, but if we select all the points together the intersection seems to take more points than requested, probably involving also the nearest points.&lt;/P&gt;&lt;P&gt;Look at this case. First we select 3 points&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-42-08.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100047i84D8CAB3F2612143/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-42-08.png" alt="2024-04-03_09-42-08.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and all seems fine:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-43-43.png" style="width: 960px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100051iBC0991A0F3AE8DCF/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-43-43.png" alt="2024-04-03_09-43-43.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Three points are selected correctly. In the console you see 4 because one is always junk and not used.&lt;/P&gt;&lt;P&gt;Then we take 4 other points on the same street:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-45-46.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100053iEEA88340C2A5193D/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-45-46.png" alt="2024-04-03_09-45-46.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Even in this case the result is correct:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-46-11.png" style="width: 980px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100054iC822446D0046CDF3/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-46-11.png" alt="2024-04-03_09-46-11.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(One point is always junk and not used)&lt;/P&gt;&lt;P&gt;Finally, we select the remaining 2 points&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-48-01.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100056i26913974D9F46668/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-48-01.png" alt="2024-04-03_09-48-01.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and in this case too, all is correct.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-48-22.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100058i96A67EF5AC524082/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-48-22.png" alt="2024-04-03_09-48-22.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So, in total, I've selected 9 points (consider that for each selection one is always dummy)&lt;/P&gt;&lt;P&gt;But, if select all the points together using a segmented line&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-49-22.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100059i0B745E86CF890F1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-49-22.png" alt="2024-04-03_09-49-22.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;it brings me more than the ones I selected&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-03_09-50-03.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100061iB859BAAC8B5914DC/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-03_09-50-03.png" alt="2024-04-03_09-50-03.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;How can I fix this strange behavior? Why it's not so accurate when I extract the selected points?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 15:33:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersection-is-not-accurate/m-p/1405817#M84227</guid>
      <dc:creator>AndreaRosati</dc:creator>
      <dc:date>2024-04-04T15:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection is not accurate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersection-is-not-accurate/m-p/1405824#M84228</link>
      <description>&lt;P&gt;Others are far more proficient in 4.x than I am but could it be that you're using&amp;nbsp;event.graphic.geometry.extent which might be treated as a bounding box for the graphic rather than it's actual shape?&lt;/P&gt;&lt;P&gt;In the selections that work, you'll notice that there aren't other points located within the square of your selection but if you look at your polygon selection, and use the xmin,ymin.xmax,ymax rectangle of the polygon, you'll see that many other points would be selected based on that rectangular shape.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 15:48:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersection-is-not-accurate/m-p/1405824#M84228</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2024-04-04T15:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection is not accurate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersection-is-not-accurate/m-p/1406217#M84236</link>
      <description>&lt;P&gt;Hi Steve, thanks for your answer!&lt;/P&gt;&lt;P&gt;However, I'm not sure this is the real cause of the problem. Indeed, if I rotate a little bit the map and use only the rectangular selection, I have the same issue. Look at this new example.&lt;/P&gt;&lt;P&gt;I have 9 points here on the same street with a shorter selection:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-05_09-00-45.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100167i9A0EA69F71968ACC/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-05_09-00-45.png" alt="2024-04-05_09-00-45.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-05_09-01-22.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100166iC8B069CA71D7BB8E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-05_09-01-22.png" alt="2024-04-05_09-01-22.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But as soon as I extend the selection on the right, without including other points, the number of the points returned is greater:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-05_09-02-00.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100169i28E5603E5639DC98/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-05_09-02-00.png" alt="2024-04-05_09-02-00.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-04-05_09-02-32.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100168i63A8E06B2323E90B/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-04-05_09-02-32.png" alt="2024-04-05_09-02-32.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Very strange behaviour. I hope that someone can help me on this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Andrea&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 07:26:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersection-is-not-accurate/m-p/1406217#M84236</guid>
      <dc:creator>AndreaRosati</dc:creator>
      <dc:date>2024-04-05T07:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection is not accurate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersection-is-not-accurate/m-p/1406661#M84245</link>
      <description>&lt;P&gt;Andrea,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if you rotated the map then the extent might not be what you think it is.&amp;nbsp; As mentioned by Steve, you should not use the extent as it will not provide the correct intersection results since the geometry and the extent are different.&amp;nbsp; Maybe something like the code below might help.&amp;nbsp; Also, its hard to tell exactly what might be going on, so something that will help is if you have a CodePen or similar so we can experience the issue and help you out.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const searchGeometry = event.graphic.geometry;
const intersections = graphicsLayer.graphics.filter((graphic) =&amp;gt;
    geometryEngine.intersects(searchGeometry,graphic.geometry)
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 20:51:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersection-is-not-accurate/m-p/1406661#M84245</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2024-04-05T20:51:42Z</dc:date>
    </item>
  </channel>
</rss>

