<?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: In ESRI Leaflet, is it possible to grab a value from layer on a click event? in Open Source Mapping Libraries Ques.</title>
    <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/in-esri-leaflet-is-it-possible-to-grab-a-value/m-p/1106581#M73</link>
    <description>&lt;P&gt;I don't know Esri JS very well, but in Leaflet you can bind click events either to the entire map or to a particular marker:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;marker.on('click', function (e) {
   alert(e.latlng);
});&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 12 Oct 2021 02:27:37 GMT</pubDate>
    <dc:creator>DanielDormont</dc:creator>
    <dc:date>2021-10-12T02:27:37Z</dc:date>
    <item>
      <title>In ESRI Leaflet, is it possible to grab a value from layer on a click event?</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/in-esri-leaflet-is-it-possible-to-grab-a-value/m-p/1106561#M72</link>
      <description>&lt;P&gt;I did it in ESRI JS API like&amp;nbsp; this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;view.on("immediate-click", (event) =&amp;gt; {&lt;BR /&gt;const latitude = event.mapPoint.latitude;&lt;BR /&gt;const longitude = event.mapPoint.longitude;&lt;BR /&gt;const screenPoint = view.toScreen(new Point({latitude, longitude}));&lt;BR /&gt;view.hitTest(screenPoint).then((hitTestResult) =&amp;gt; {&lt;BR /&gt;console.log(hitTestResult);&lt;BR /&gt;soilOrder = hitTestResult.results[0].graphic.attributes.esrisymbology;&lt;BR /&gt;console.log(soilOrder);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I want to do it in Leaflet since it'll be more suited for my needs. Any idea how I can do this in leaflet?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 20:13:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/in-esri-leaflet-is-it-possible-to-grab-a-value/m-p/1106561#M72</guid>
      <dc:creator>GeoDev</dc:creator>
      <dc:date>2023-08-25T20:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: In ESRI Leaflet, is it possible to grab a value from layer on a click event?</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/in-esri-leaflet-is-it-possible-to-grab-a-value/m-p/1106581#M73</link>
      <description>&lt;P&gt;I don't know Esri JS very well, but in Leaflet you can bind click events either to the entire map or to a particular marker:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;marker.on('click', function (e) {
   alert(e.latlng);
});&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 12 Oct 2021 02:27:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/in-esri-leaflet-is-it-possible-to-grab-a-value/m-p/1106581#M73</guid>
      <dc:creator>DanielDormont</dc:creator>
      <dc:date>2021-10-12T02:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: In ESRI Leaflet, is it possible to grab a value from layer on a click event?</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/in-esri-leaflet-is-it-possible-to-grab-a-value/m-p/1106822#M74</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/487776"&gt;@DanielDormont&lt;/a&gt;&amp;nbsp;is right,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/474149"&gt;@GeoDev&lt;/a&gt;,&amp;nbsp;you can attach a &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;click&lt;/FONT&gt; &lt;/STRONG&gt;listener to your Leaflet layer instance. Let's say you are using an esri-leaflet &lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;L.esri.FeatureLayer&lt;/STRONG&gt;&lt;/FONT&gt;, then you could attach a click listener like so and inspect the event object to get client-side feature attributes.&lt;/P&gt;&lt;PRE&gt;myFeatureLayer.on('click', function(e) {&lt;BR /&gt;  console.log(e.layer.feature.properties);&lt;BR /&gt;});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reference:&amp;nbsp;&lt;A href="https://esri.github.io/esri-leaflet/api-reference/layers/feature-layer.html#events" target="_self"&gt;https://esri.github.io/esri-leaflet/api-reference/layers/feature-layer.html#events&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 19:22:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/in-esri-leaflet-is-it-possible-to-grab-a-value/m-p/1106822#M74</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-10-12T19:22:58Z</dc:date>
    </item>
  </channel>
</rss>

