Skip to main content

I’d like to find out more about adding legends to WMS maps from Sentinel Hub (and rendering these using Leaflet).



  1. Is there a default for legends? I am unable to find these, using the GetLegendGraphic request ( https://services.sentinel-hub.com/ogc/wms/{instanceId}?service=WMS&request=GetLegendGraphic&layer={layer} )




  2. If there is no default, is there some way to retrieve the colours generated by the HighlightCompressVisualizer and their corresponding values, such that this can be used to create a custom legend in the Advanced Layer Editor?




  3. If the colours can not be automatically retrieved, is there a more complete set of processing scripts and legends such as this for NDVI (for layers such as moisture index and false-colour).



Finally, once I have the legend, how can I render this using Leaflet? I found the option to generate an instance ID, open in EO browser and generate code using the wrench, but this does not include a legend.

To create your own legend, check this:

8340e4218a14802eee3343ca9bbabef822f13805.pngsentinel-hub.com
d3714e73b38a87afa3c31502a6696052a7395163.png


How can I define a custom legend?



How can I define a custom legend? In the Sentinel Hub Configuration Tool, instance configuration, advanced layer editor. Follow the instructions here.







All products from EO Browser should be available here:

favicon.svggithub.com

custom-scripts/sentinel-2 at master · sentinel-hub/custom-scripts



master/sentinel-2



A repository of custom scripts to be used with Sentinel Hub






Hopefully this helps?


Hi, your suggestion is what I had found, and what I referred to under point 2 of my original post (“create a custom legend in the Advanced Layer Editor”).


My question is: HOW do I get colour and numerical values that match those being rendered on the map?


This depends on the layer by layer basis so it is not possible to answer in a generic manner.

In most cases it is linear interpolation between two colors. But rather than bothering with this we suggest you configure new layers in line with your requirements, similarly as you see it for NDVI.


Reply