First note - whenever you work with TIME parameter, do use YYYY-MM-DD/YYYY-MM-DD value as TIME is interpreted as “FROM/TO”. If you only set one date, it will be interpreted as “FROM BEGINNING OF TIME/TO SET DATE”. If you use MAXCC=100 and PRIORITY=mostRecent, you should get the same result, in other cases not certain.
As I started to work with it before your edit, I created a new instance in your account called “TEST”, which has two layers - EVI-COLOR (for visualization, returning a combination of red, green, blue) and EVI-VALUE (returning actual value).
Basic visualization call:
https://services.sentinel-hub.com/ogc/wms/63f81d20-XYZ?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&TIME=2018-09-10&LAYERS=EVI-VALUE&RESX=10m&RESY=10m&CRS=EPSG:4326&TRANSPARENT=1&FORMAT=image/png&GEOMETRY=POLYGON((-32.28555%20-64.23295,-32.28555%20-64.22177,-32.29489%20-64.22177,-32.29489%20-64.23295,-32.28555%20-64.23295))
Statistical API call:
http://services.sentinel-hub.com/ogc/fis/63f81d20-XYZ?LAYER=EVI-VALUE&TIME=2018-09-10/2018-09-10&CRS=EPSG:4326&GEOMETRY=POLYGON((-32.28555%20-64.23295,-32.28555%20-64.22177,-32.29489%20-64.22177,-32.29489%20-64.23295,-32.28555%20-64.23295))&RESX=10m&RESY=10m
Returns:
{"C0":[{"date":"2018-09-10","basicStats":{"min":0.07955596596002579,"max":0.34055188298225403,"mean":0.1437222329933777,"stDev":0.021603603049859553}}]}
You need to call FIS from your application (or bash script) and then read the values with some JSON parser, getting min/max:
min = 0.07955596596002579;
max = 0.34055188298225403;
What you then need to do is to embed this value in custom script “template” as shown bellow. This step is also done in your application/bash script, for each call separately.
function evaluatePixel(samples) {
let val = index(samples[0].B08, samples[0].B04);
var min = 0.07955596596002579;
var max = 0.34055188298225403;
var step = (max-min)/5;
return colorBlend(val,[min, min +1*step, min +2*step, min +3*step, min +4*step, min +5*step],
[[0.815, 0.450, 0.345],
[0.815, 0.666, 0.345],
[0.815, 0.807, 0.345],
[0.745, 0.815, 0.345],
[0.549, 0.815, 0.345],
[0.439, 0.815, 0.345]]);;
}
function setup(ds) {
setInputComponents([ds.B04, ds.B08]);
setOutputComponentCount(3);
}
Once you have script prepared, you need to BASE64 encode it (there are usually standard functions available for that). For the purpose of this exercise I did it manually using on-line tool.
BASE64 encoded script looks like:
ZnVuY3Rpb24gZXZhbHVhdGVQaXhlbChzYW1wbGVzKSB7CmxldCB2YWwgPSBpbmRleChzYW1wbGVzWzBdLkIwOCwgc2FtcGxlc1swXS5CMDQpOwp2YXIgbWluID0gMC4wNzk1NTU5NjU5NjAwMjU3OTsKdmFyIG1heCA9IDAuMzQwNTUxODgyOTgyMjU0MDM7CnZhciBzdGVwID0gKG1heC1taW4pLzU7CgpyZXR1cm4gY29sb3JCbGVuZCh2YWwsW21pbiwgbWluICsxKnN0ZXAsIG1pbiArMipzdGVwLCBtaW4gKzMqc3RlcCwgbWluICs0KnN0ZXAsIG1pbiArNSpzdGVwXSwKW1swLjgxNSwgMC40NTAsIDAuMzQ1XSwKWzAuODE1LCAwLjY2NiwgMC4zNDVdLApbMC44MTUsIDAuODA3LCAwLjM0NV0sClswLjc0NSwgMC44MTUsIDAuMzQ1XSwKWzAuNTQ5LCAwLjgxNSwgMC4zNDVdLApbMC40MzksIDAuODE1LCAwLjM0NV1dKTs7Cn0KCmZ1bmN0aW9uIHNldHVwKGRzKSB7CnNldElucHV0Q29tcG9uZW50cyhbZHMuQjA0LCBkcy5CMDhdKTsKc2V0T3V0cHV0Q29tcG9uZW50Q291bnQoMyk7Cn0=
Now you simply pass this value as EVALSCRIPT, overriding the default style:
https://services.sentinel-hub.com/ogc/wms/63f81d20-XYZ?SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0&TIME=2018-09-10&LAYERS=EVI-COLOR&RESX=10m&RESY=10m&CRS=EPSG:4326&TRANSPARENT=1&FORMAT=image/png&GEOMETRY=POLYGON((-32.28555%20-64.23295,-32.28555%20-64.22177,-32.29489%20-64.22177,-32.29489%20-64.23295,-32.28555%20-64.23295))&EVALSCRIPT=ZnVuY3Rpb24gZXZhbHVhdGVQaXhlbChzYW1wbGVzKSB7CmxldCB2YWwgPSBpbmRleChzYW1wbGVzWzBdLkIwOCwgc2FtcGxlc1swXS5CMDQpOwp2YXIgbWluID0gMC4wNzk1NTU5NjU5NjAwMjU3OTsKdmFyIG1heCA9IDAuMzQwNTUxODgyOTgyMjU0MDM7CnZhciBzdGVwID0gKG1heC1taW4pLzU7CgpyZXR1cm4gY29sb3JCbGVuZCh2YWwsW21pbiwgbWluICsxKnN0ZXAsIG1pbiArMipzdGVwLCBtaW4gKzMqc3RlcCwgbWluICs0KnN0ZXAsIG1pbiArNSpzdGVwXSwKW1swLjgxNSwgMC40NTAsIDAuMzQ1XSwKWzAuODE1LCAwLjY2NiwgMC4zNDVdLApbMC44MTUsIDAuODA3LCAwLjM0NV0sClswLjc0NSwgMC44MTUsIDAuMzQ1XSwKWzAuNTQ5LCAwLjgxNSwgMC4zNDVdLApbMC40MzksIDAuODE1LCAwLjM0NV1dKTs7Cn0KCmZ1bmN0aW9uIHNldHVwKGRzKSB7CnNldElucHV0Q29tcG9uZW50cyhbZHMuQjA0LCBkcy5CMDhdKTsKc2V0T3V0cHV0Q29tcG9uZW50Q291bnQoMyk7Cn0=
As mentioned, you need to do this as a two step process within your application.