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.
//xCord and yCord are the long and lat
let pt = esri.geometry.geographicToWebMercator(new esri.geometry.Point(xCord, yCord));
let result = map.layers.getItemAt(0).geometry.contains(pt);
console.log("Result is: " + result);
Thanks in advance!
Solved! Go to Solution.
Hi there,
You will be able to do this on the client using ImageryLayerView.pixelData by getting updated pixel data whenever the layerview is updated.
You'll have to create the ImageryLayer.format with `lerc` option so that you can access the pixel data on the client. You can set the pixelFilter to change the pixel colors. This sample shows you how to do it.
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.
I have created this sample app to show what is involved.
Hope this helps
Hi there,
You will be able to do this on the client using ImageryLayerView.pixelData by getting updated pixel data whenever the layerview is updated.
You'll have to create the ImageryLayer.format with `lerc` option so that you can access the pixel data on the client. You can set the pixelFilter to change the pixel colors. This sample shows you how to do it.
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.
I have created this sample app to show what is involved.
Hope this helps