<?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 Check if a point given a longitude and latitude is in a imageLayer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/check-if-a-point-given-a-longitude-and-latitude-is/m-p/432136#M39821</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working with arcGIS JavaScript API 4.11. I am trying to see if a point which I provided a longitude and latitude is in a image layer or not. Any suggestions? The code below is what I am trying to use.&lt;/P&gt;&lt;P&gt;//xCord and yCord are the long and lat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;let pt = esri.geometry.geographicToWebMercator(new esri.geometry.Point(xCord, yCord));&lt;/P&gt;&lt;P&gt;let result = map.layers.getItemAt(0).geometry.contains(pt);&lt;BR /&gt; console.log("Result is: " + result);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 May 2019 20:55:44 GMT</pubDate>
    <dc:creator>StevenStapleton1</dc:creator>
    <dc:date>2019-05-10T20:55:44Z</dc:date>
    <item>
      <title>Check if a point given a longitude and latitude is in a imageLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/check-if-a-point-given-a-longitude-and-latitude-is/m-p/432136#M39821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working with arcGIS JavaScript API 4.11. I am trying to see if a point which I provided a longitude and latitude is in a image layer or not. Any suggestions? The code below is what I am trying to use.&lt;/P&gt;&lt;P&gt;//xCord and yCord are the long and lat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;let pt = esri.geometry.geographicToWebMercator(new esri.geometry.Point(xCord, yCord));&lt;/P&gt;&lt;P&gt;let result = map.layers.getItemAt(0).geometry.contains(pt);&lt;BR /&gt; console.log("Result is: " + result);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 May 2019 20:55:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/check-if-a-point-given-a-longitude-and-latitude-is/m-p/432136#M39821</guid>
      <dc:creator>StevenStapleton1</dc:creator>
      <dc:date>2019-05-10T20:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a point given a longitude and latitude is in a imageLayer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/check-if-a-point-given-a-longitude-and-latitude-is/m-p/432137#M39822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will be able to do this on the client using&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-ImageryLayerView.html#pixelData"&gt;&amp;nbsp;ImageryLayerView.pixelData&lt;/A&gt;&amp;nbsp;by getting updated pixel data whenever the layerview is updated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll have to create the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html#format"&gt;ImageryLayer.format&lt;/A&gt; with `lerc` option so that you can access the pixel data on the client. You can set the pixelFilter to change the pixel colors. &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-imagery-attribute-table/index.html"&gt;This sample&lt;/A&gt; shows you how to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In view's click event, you'd have to figure out the pixel index from the mouse location and get the data for that pixel.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created &lt;A href="https://codepen.io/U_B_U/pen/QRGXEK?editors=1000"&gt;this sample app&lt;/A&gt; to show what is involved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 May 2019 18:37:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/check-if-a-point-given-a-longitude-and-latitude-is/m-p/432137#M39822</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2019-05-17T18:37:27Z</dc:date>
    </item>
  </channel>
</rss>

