<?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 Re: HitTest Question in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-question/m-p/1050385#M72702</link>
    <description>&lt;P&gt;Thanks for the suggestion, I can play around with that idea and see where I can take it.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Apr 2021 21:19:07 GMT</pubDate>
    <dc:creator>AndrewMurdoch1</dc:creator>
    <dc:date>2021-04-22T21:19:07Z</dc:date>
    <item>
      <title>HitTest Question</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-question/m-p/1050233#M72698</link>
      <description>&lt;P&gt;Good Day&lt;BR /&gt;&lt;BR /&gt;I have a map with a mix of points and polygons:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndrewMurdoch1_0-1619115131522.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11567iC24872FEDB9ADE40/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndrewMurdoch1_0-1619115131522.png" alt="AndrewMurdoch1_0-1619115131522.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I zoom out and try to select a polygon near the point, the point will almost always be included in the Hit Test, to spite not overlapping the polygon.&amp;nbsp; In this case I was trying to select the area pointed to by the red arrow.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndrewMurdoch1_1-1619115240313.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11568i1F6AC8A4AC2D1DDA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndrewMurdoch1_1-1619115240313.png" alt="AndrewMurdoch1_1-1619115240313.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I look at the hit test I see two elements, are obviously the point and the polygon:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndrewMurdoch1_2-1619115316760.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11569iA263FB95C2386514/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndrewMurdoch1_2-1619115316760.png" alt="AndrewMurdoch1_2-1619115316760.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My question is, how do I query the correct object?&amp;nbsp; It has the screen point, which I assume has to be the tip of the mouse pointer, so is there away to correlate that again the objects returned from the Hit Test?&lt;BR /&gt;&lt;BR /&gt;This is core part of the Hit Function:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;clickHandler&lt;/SPAN&gt;() {&lt;BR /&gt;  &lt;SPAN&gt;this&lt;/SPAN&gt;.&lt;SPAN&gt;_view&lt;/SPAN&gt;.&lt;SPAN&gt;on&lt;/SPAN&gt;(&lt;SPAN&gt;'click'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;(event) =&amp;gt; {&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;console&lt;/SPAN&gt;.&lt;SPAN&gt;clear&lt;/SPAN&gt;()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;console&lt;/SPAN&gt;.&lt;SPAN&gt;log&lt;/SPAN&gt;(&lt;SPAN&gt;'Click Event'&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;console&lt;/SPAN&gt;.&lt;SPAN&gt;log&lt;/SPAN&gt;(event)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    this&lt;/SPAN&gt;.&lt;SPAN&gt;_view&lt;/SPAN&gt;.&lt;SPAN&gt;hitTest&lt;/SPAN&gt;(event).&lt;SPAN&gt;then&lt;/SPAN&gt;((response) =&amp;gt; {&lt;BR /&gt;&lt;BR /&gt;      &lt;SPAN&gt;console&lt;/SPAN&gt;.&lt;SPAN&gt;log&lt;/SPAN&gt;(&lt;SPAN&gt;'Hit Test Result'&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;      &lt;SPAN&gt;console&lt;/SPAN&gt;.&lt;SPAN&gt;log&lt;/SPAN&gt;(response)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;    })&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;  })&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;}&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 18:17:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-question/m-p/1050233#M72698</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-04-22T18:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: HitTest Question</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-question/m-p/1050310#M72701</link>
      <description>&lt;P&gt;You could search by geometry type if that's what you're looking for.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// by geometry
const result = results.find(a =&amp;gt; a.graphic.geometry.type === "polygon");

// by layer type, vector tiles are included in hitTest
// so this will rule that result out
const result = results.find(a =&amp;gt; a.graphic.layer.type === "2d");&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 22 Apr 2021 19:51:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-question/m-p/1050310#M72701</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-04-22T19:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: HitTest Question</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-question/m-p/1050385#M72702</link>
      <description>&lt;P&gt;Thanks for the suggestion, I can play around with that idea and see where I can take it.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 21:19:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-question/m-p/1050385#M72702</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-04-22T21:19:07Z</dc:date>
    </item>
  </channel>
</rss>

