I just need some help adding a legend data to my script for use in EO Browser. I have looked online and tried to figure out how to put it into the script, but nothing seems to work. I am using a script already made, available in the Github, by Mohor Gartner… any help would be super appreciated. I do not really know how to code at all.
The code for the legend has to be added to the advanced Layer settings in the Dashboard, so you would need to create an instance and a layer in that instance with the evalscript you want to use.
The process of adding the legend is described on this FAQ page along with a short explanation of the legend.
The legend will be displayed in the description of the layer in the EO Browser and in the downloaded image, if you choose to include the legend in the downloaded image.
The legend can be of 2 types - continuous or discrete.
Continuous is meant more for making sense of the indices (NDVI, NDSI, etc.), where the values are continuous. It can have more gradient steps with multiple gradient stop points.
Discrete is meant more for making sense of the discrete values, like for classes in classifications (e.g. scene classification).
A note for the continuous legends:
The position values do not necessarily correspond to the values that the evalscript returns because the position values also determine how much space some gradient step takes.
The label values for the gradient colors, for which you want to add the label, should be the same as the values the evalscript returns.
It’s a bit hard to set the legends for some of the evalscripts, especially if you don’t know the min and max values (in the evalscript) and their colors. In those cases it’s easiest to only set one gradient step (with 2 stop points - min and max values). Do let us know if you get stuck again.