Colour scheme ndvi wms

Hi,

I would like to know how can I personalize the NDVI WMS colour scheme in the “Advanced layer editor” within the “Sentinel Hub Configuration Utility”.
In addition, I would like that a leyend appears when I open the WMS in a GIS Software.

LEYEND_WMS

Thanks in advance,
Enrique.

I suggest you check the following links:

Hi gmilcinski,

Thank you for your answer.

Now I got clear how the code should be written for editing the NDVI colour scheme, however I still do not know where to write the code withing the “Advanced layer editor”.

I mean that, for instance, in the link related with the leyend code you just sent me, it put very clear where I have to insert the code:

LEYEND_CODE

However, for editing the NDVI colour scheme I know that I have to use this code:

NDVI_COLOUR_SCHEME

But I do not know where I have to put it in here:

Thanks in advance,
Enrique.

You do not need to write this code in advanced layer editor
You have a dedicated element for this, click pencil icon near “Use predefined product or enter your processing script”.


and then enter the code here:

Thank you for your answer gmilcinski,

I paste the code as you told me but It is like the NDVI layer has lost its reference system, since the base map does not appear in the preview and when I try to visualice the WMS in other software there is no data.

Thanks in advance,
Enrique.

The configuration seems to be OK.
There is no problem with reference system and base map is there as well. It is just that you have set “Map bounds” and everything out of these is shown white in the preview.

Thank ypu for your answer gmilcinski,

The problem is that when I put the WMS in QGIS there is no geographic representation:

So I try with a predefine colour scheme and when the base map appears always works in QGIS. Thats why I told you about the base, because I think it is an indicator that something is not working.

Thanks in advance,
Enrique.

Colour scheme has no relation to the georeference so the problem must be elsewhere.
It seems you now changed something in the script, which caused it to be invalid. There was one “[” missing in it. I corrected it and now it works, both in preview as well as in QGIS.


It will only show data near Madrid though due to “Map bound” settings, which I suggest you clear in this stage, so that you get data everywhere…

Thank you for your answer gmilcinski,

I manage to solve the problem with the script. I started a new one and It works.

Now the last problem to solve is that when I insert the legend it says that the code is not correct, however I review every bracket, since the problem must be there considering that I paste the rest, and I can not find any mistake.

Thanks in advance,
Enrique.

Please paste the legend code here so that I can try.

{
@id”: “https://services.sentinel-hub.com/configuration/v1/wms/instances/b2f1a9f4-29be-4b01-a0d8-4d417d66a151/layers/NDVI”,
“id”: “NDVI”,
“title”: “NDVI”,
“description”: “”,
“styles”: [
{
“name”: “default”,
“description”: “Default layer style”,
“evalScript”: “let ndvi = (B08 - B04) / (B08 + B04);\n\nreturn colorBlend(ndvi,\n [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0 ],\n [[165/255,0,38/255], // -> .2 = #a50026\n [253/255,174/255,97/255], // -> .3 = #fdae61\n [254/255,224/255,139/255], // -> .4 = #fee08b\n [255/255,255/255,191/255], // -> .5 = #ffffbf\n [217/255,239/255,139/255], // -> .6 = #d9ef8b\n [166/255,217/255,106/255], // -> .7 = #a6d96a\n [102/255,189/255,99/255], // -> .8 = #66bd63\n [26/255,152/255,80/255], // -> .9 = #1a9850\n [0,104/255,55/255] // -> 1.0 = #006837\n ]);”,
“dataProduct”: null
},
“legend”:{
“type”:“discrete”,
“items”:[
{“color”:"#a50026",
“label”:"< 0.2"},
{“color”:"#fdae61",
“label”:“0.2 – 0.3”},
{“color”:"#fee08b",
“label”:“0.3 – 0.4”},
{“color”:"#ffffbf",
“label”:“0.4 – 0.5”},
{“color”:"#d9ef8b",
“label”:“0.5 – 0.6”},
{“color”:"#a6d96a",
“label”:“0.6 – 0.7”},
{“color”:"#66bd63",
“label”:“0.7 – 0.8”},
{“color”:"#1a9850",
“label”:“0.8 – 0.9”},
{“color”:"#006837",
“label”:“0.9 - 1”}
]
}
],
“orderHint”: 0,

I guess there was some weird character error. What I did was copy-paste the example from FAQ and then just replaced the relevant parts with your code. It seems to work fine.

I just realized that the problem was that I put “legend” at the begining of the legend code and I did not have to put it.

Thank you for your time gmilcinski.

Hi gmilcinski,

I just realized that in QGIS the legend appears well

But in arcgis the legend does not appear. However, if you make right click in the layer, you can add the legend as an image. Nevertheless, for visualizing the wms in arcgis online this is not an option.

Do you have this problem before? Is there any way to make it appear like in QGIS?

Thanks in advance,
Enrique.

I am not an expert in ArcGIS but we have found other limitations on how they “support” OGC standards.
I cannot help you with this one unfortunately. I suggest you contact ESRI support and ask them about it.