<?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 Pick up nearest feature from mouse click in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pick-up-nearest-feature-from-mouse-click/m-p/1234541#M79432</link>
    <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;I'd like to be able to click near, but not directly on our street feature (line) layer and it return the street reference number from the nearest street in that layer.&lt;/P&gt;&lt;P&gt;We've got a number of public facing maps that are used to report issues that are not directly on but are near a street such as in a verge or a hedge etc. Our back office system needs the nearest street to the issue and currently we ask the customer to search for the nearest street and enter it manually into the form.&lt;/P&gt;&lt;P&gt;I've had a look through all the guidance and on here but I'm not sure where to get started with it. I don't think a 'locator' for reverse geocoding will do the job, I just need to interact with the nearest feature.&lt;/P&gt;&lt;P&gt;Here is an example of a map that I would update to include the nearest streets reference number.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://codepen.io/RFletERYC/full/RwyYvBe" target="_blank" rel="noopener"&gt;https://codepen.io/RFletERYC/full/RwyYvBe&lt;/A&gt;&lt;/P&gt;&lt;P&gt;As you will see you can click anywhere on the map and it returns the X/Y coordinates which are then fed into our back office system. You can interact with the street layer too. But how do I pick up the details of the street when I'm not directly interacting with it?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance. Ricky&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2022 16:20:27 GMT</pubDate>
    <dc:creator>ITApplications</dc:creator>
    <dc:date>2022-11-23T16:20:27Z</dc:date>
    <item>
      <title>Pick up nearest feature from mouse click</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pick-up-nearest-feature-from-mouse-click/m-p/1234541#M79432</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;I'd like to be able to click near, but not directly on our street feature (line) layer and it return the street reference number from the nearest street in that layer.&lt;/P&gt;&lt;P&gt;We've got a number of public facing maps that are used to report issues that are not directly on but are near a street such as in a verge or a hedge etc. Our back office system needs the nearest street to the issue and currently we ask the customer to search for the nearest street and enter it manually into the form.&lt;/P&gt;&lt;P&gt;I've had a look through all the guidance and on here but I'm not sure where to get started with it. I don't think a 'locator' for reverse geocoding will do the job, I just need to interact with the nearest feature.&lt;/P&gt;&lt;P&gt;Here is an example of a map that I would update to include the nearest streets reference number.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://codepen.io/RFletERYC/full/RwyYvBe" target="_blank" rel="noopener"&gt;https://codepen.io/RFletERYC/full/RwyYvBe&lt;/A&gt;&lt;/P&gt;&lt;P&gt;As you will see you can click anywhere on the map and it returns the X/Y coordinates which are then fed into our back office system. You can interact with the street layer too. But how do I pick up the details of the street when I'm not directly interacting with it?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance. Ricky&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 16:20:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pick-up-nearest-feature-from-mouse-click/m-p/1234541#M79432</guid>
      <dc:creator>ITApplications</dc:creator>
      <dc:date>2022-11-23T16:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Pick up nearest feature from mouse click</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pick-up-nearest-feature-from-mouse-click/m-p/1234578#M79434</link>
      <description>&lt;P&gt;I have not done this, but it looks like you could use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#nearestCoordinate" target="_self"&gt;geometryEngine nearestCoordinate&lt;/A&gt; to get the location on a feature. Then you could use the coordinate from the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#NearestPointResult" target="_self"&gt;NearestPointResult&lt;/A&gt; object to &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-query.html" target="_self"&gt;query&lt;/A&gt; your feature layer for intersecting geometry.&lt;/P&gt;&lt;P&gt;Edit:&lt;BR /&gt;Since you will probably have to input the geometry of all features for the nearestCoordinate, you might as well reuse those with the geometryEngine again with &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#intersects" target="_self"&gt;intersects&lt;/A&gt;&amp;nbsp;(iterating over all features) instead of querying the feature layer.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 17:21:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pick-up-nearest-feature-from-mouse-click/m-p/1234578#M79434</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2022-11-23T17:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Pick up nearest feature from mouse click</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pick-up-nearest-feature-from-mouse-click/m-p/1236391#M79490</link>
      <description>&lt;P&gt;Thanks for the helpful pointers Blake.&lt;BR /&gt;&lt;BR /&gt;I've also not done this before and being fairly new to JS it looks beyond my current skill set to write it from scratch. Using your links above, I'll see if I can find a sample that's doing roughly what I'm after and adapt that to my means.&lt;/P&gt;&lt;P&gt;Wish me luck!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 15:28:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pick-up-nearest-feature-from-mouse-click/m-p/1236391#M79490</guid>
      <dc:creator>ITApplications</dc:creator>
      <dc:date>2022-11-30T15:28:30Z</dc:date>
    </item>
  </channel>
</rss>

