NDVI Visualization with Custom Colours returns Colour Values on Click instead of actual Pixel Value

Hey, this was already answered in How to get NDVI index value of the pixel, where more resources are linked.

To briefly answer, Leaflet only returns the value that is in the image at that pixel.

If the visualization is not that important, you can return the actual NDVI value in the evalscript, so the value returned by Leaflet will be correct. But as mentioned, the visualization will probably not be the desired one.

In EO Browser, this is solved by getting the coordinates of the click (actually, the coordinates of the marker placed by a user), creating a small geometry around that location, and making a request to Statistical API to get the NDVI value.
Processing API could be used instead, with width and height of the returned image set to 1px (to make it easier to get the value out).

Hope this helps.

Cheers.

1 Like