Skip to main content

Confusion and errors about NDVI scripts

  • 26 April 2024
  • 2 replies
  • 3 views

Hello.
I’d like to get NDVI images as the result in the EO/Copernicus browser, that is intense green for vivid vegetation, through pale yellow for dry surfaces, to gray for water.
Well, I tried with both a simple NodeJS app and also by the Sentinel configurator.

Let’s start from the latter.
I copied the script as in the EO/Copernicus browser, NDVI section, as the resulting image looks fine to me. Then, I pasted the script as-is in the configurator, as custom script for the id:NDVI, finally saved the layer. Yet the preview signals an error

Something went wrong fetch the tiles

Apparently, the same error results in the NodeJS app, which leverages the sentinelhub-js package: the getMap call raises a HTTP 400 error. Both when I use the script in the configurator and when I try to specify the same one in the S2L2ALayer instance creation.

If I choose any other preset, both the preview and the app do work fine.
The secondary problem is that the presets given in the configurator, seem to colorize in a different way the map. E.g. the green NDVI yields kind of “negative” result than the EO/Copernicus browser’s one.
Thanks

Hello,

the NDVI script which you can copy straight from EO Browser includes some other outputs for additional functionality specific to the browser. This will not work with normal WMS layers.

The best fit for you would be the NDVI script under the visualization tab in the custom script repository: Normalized difference vegetation index | Sentinel Hub custom scripts


That works.
Not very intuitive, IMHO, but it works.
Thanks.


Reply