Histrogram data fetch

Hello,

We are trying to get information about Histrogram, with following URL.

https://services.sentinel-hub.com/ogc/fis/a30ea8e9-?LAYER=NDVITEST&GEOMETRY=POLYGON((28.1064924267854%20-22.9535551593481%2C28.1071164984511%20-22.9513951564434%2C28.1089994970033%20-22.9518707376107%2C28.1092561181462%20-22.9519723316956%2C28.1097204592471%20-22.9521664422107%2C28.1100038500983%20-22.9522316879977%2C28.110546816789%20-22.952337490994%2C28.1108185451398%20-22.9523510807468%2C28.1110866249096%20-22.9523612629498%2C28.1129063656819%20-22.9528447247923%2C28.1113935444317%20-22.9584541011293%2C28.1055650102954%20-22.9569716585293%2C28.1064924267854%20-22.9535551593481))&RESOLUTION=10&MAXCC=5&BINS=5&CRS=EPSG%3A3857&TIME=2015-01-01%2F2015-10-01&STYLE=INDEX

It is returning empty json. Can you have a look into this and help us.

Thanks

Hi,

there are 2 problems that I can find:

  • Coordinates of your polygon are in EPSG:4326, but you specified CRS=EPSG:3857.

  • For EPSG:4326 standard WCS 1.1.1 is used. Therefore you have to specify coordinates in order latitude/longitude. I think your current order is longitude/latitude.

I hope that works.

Okay, I have made above changes and use BBOX

https://services.sentinel-hub.com/ogc/fis/a30ea8e9--?LAYER=NDVITEST&bbox=-22.9535551593481%2C28.1064924267854%2C-22.9835551593481%2C28.1071164984511&RESOLUTION=10&MAXCC=5&BINS=5&CRS=EPSG%3A4326&TIME=2015-01-01%2F2015-10-01&STYLE=INDEX
it is return empty json.

Thanks

Two more things:

  • According to documentation when using EPSG:4326 one has to add suffix m to resolution parameter. So you have to use RESOLUTION=10m instead of RESOLUTION=10.

  • It turns out that first available acquisition for that area is 2015-10-03. Therefore your current time range doesn’t find anything. Try changing it to e.g. TIME=2015-01-01%2F2015-12-01.

With these 2 changes I get the non-empty response.

Thank you very much, we are now getting results.
Our aim is to relate the histogram bins to our NDVI legend.
Is there a way that we can specify the values of the bins? Like the values of the NDVI legend eg 0.1, 0.2, 0.3 etc
Eg. 0.9 and not 0.9234587

At the moment it is not possible to specify values of the bins. However there are other ways how to achieve that. For example you could edit the definition of your layer NDVITEST in Sentinel Hub Configurator in a way that it would input only certain values. Then you would know which numbers were mapped to which bin.

E.g. if your layer would be defined as

var ndvi = (B08 - B04) / (B08 + B04)
return [ndvi]

you could define it as

var ndvi = (B08 - B04) / (B08 + B04)
return [Math.round(ndvi * 10) / 10]

Then all values returned by layer would be rounded to one decimal.

Thank you very much for the assistance!

Hello,

As for FIS request,

As EPSG 4326 have format longitude and latitude. http://spatialreference.org/ref/epsg/wgs-84/

We have data in EPSG 4326 format. What is best way to convert lonitude latitude to latitude longitude?

Thanks

The order of coordinates in EPSG 4326 actually depends on the OGC standard of the service. There is a huge confusion in geospatial community about which order should be used. Here is a nice post that explains the problem: https://macwright.org/lonlat/

In general I suggest you simply switch the order of coordinates in each url request to FIS services.

Hello,

I have tried but can’t be find solutions to convert longitude, latitude based wkt format to latitude, longitude.

Can you help on this?

You can try with this.
POLYGON((27.835116433823 -23.1226237501141,27.8356971858588 -23.1228443538851,27.8362901222702 -23.1231252560092,27.8366352306342 -23.1234291320641,27.8369270375218 -23.123807392611,27.8371129194592 -23.1242669180653,27.8372386031201 -23.1248791126317,27.8372277559912 -23.1252490807452,27.8371907925687 -23.1255777451774,27.8369303578666 -23.126177651603,27.8365232517629 -23.1266502277617,27.836023959974 -23.1270317622336,27.835372652464 -23.1272837708449,27.8347420615911 -23.1273693864776,27.834097773548 -23.1273133143085,27.8336168975129 -23.1271685719218,27.8331922491071 -23.1269515706328,27.8327871940838 -23.126639211748,27.8324917393143 -23.1262689418874,27.8323146820855 -23.126003788392,27.8321021514424 -23.1254221126126,27.8320257301895 -23.1247074019977,27.8321175040553 -23.1243455265201,27.8322982931294 -23.1239666901004,27.8324267993923 -23.1237294219804,27.8326782087861 -23.1234128248376,27.8330571418756 -23.1230533636936,27.833438572013 -23.1228319386662,27.8340638713816 -23.12262880987,27.8346860567458 -23.1225560633875,27.835116433823 -23.1226237501141))

Thanks

What kind of programming language are you using?
If nothing else works, you can always split the string in several parts, by “,” and " ", and then reconstruct it back with coordinates reversed.

I am using PHP language. I can do the split, but there are other wkt string have bracket. How can i maintain this bracket with split?

What do you mean by how to maintain bracket? You can do split first by the bracket (to get polygons), then by comma (to get points) and then by space to get lat/lon. And then you put this together in the same order…

We have implemented custom solutions for converting latitude and longitude format.

{“C0”:[{“date”:“2018-06-24”,“basicStats”:{“min”:0.0,“max”:1.0,“mean”:0.49812480309167434,“stDev”:0.21741213637420015},“histogram”:{“bins”:[{“value”:0.0,“count”:107.796875},{“value”:0.20000000298023224,“count”:15.5625},{“value”:0.30000001192092896,“count”:396.0},{“value”:0.5,“count”:1388.0},{“value”:0.699999988079071,“count”:32.265625},{“value”:0.800000011920929,“count”:21.03125},{“value”:0.8999999761581421,“count”:74.578125},{“value”:1.0,“count”:182.03125}]}}],“C1”:[{“date”:“2018-06-24”,“basicStats”:{“min”:0.0,“max”:1.0,“mean”:0.3723350131565453,“stDev”:0.24323861621710793},“histogram”:{“bins”:[{“value”:0.0,“count”:618.109375},{“value”:0.30000001192092896,“count”:23.09375},{“value”:0.4000000059604645,“count”:18.015625},{“value”:0.5,“count”:1446.34375},{“value”:0.6000000238418579,“count”:24.71875},{“value”:0.699999988079071,“count”:23.0},{“value”:0.800000011920929,“count”:25.921875},{“value”:0.8999999761581421,“count”:14.71875},{“value”:1.0,“count”:23.34375}]}}],“C2”:[{“date”:“2018-06-24”,“basicStats”:{“min”:0.0,“max”:0.8999999761581421,“mean”:0.5133159664105881,“stDev”:0.1950621611224928},“histogram”:{“bins”:[{“value”:0.0,“count”:139.75},{“value”:0.10000000149011612,“count”:52.390625},{“value”:0.20000000298023224,“count”:9.921875},{“value”:0.30000001192092896,“count”:277.0},{“value”:0.4000000059604645,“count”:19.984375},{“value”:0.5,“count”:210.0},{“value”:0.6000000238418579,“count”:1388.0},{“value”:0.699999988079071,“count”:23.0},{“value”:0.800000011920929,“count”:15.5625},{“value”:0.8999999761581421,“count”:81.65625}]}}]}

In above json format we are getting C0, C1 and C2 for same date. C0, C1 and C2 so…

What is this represent? C0, C1 and C2 Are there any way know how many objects comes like C0 to C2 or son on…

THanks

C0, C1, C2, … are “channels” of the result array. You would usually have 3 channels with RGB outputs, e.g. true colour, NDVI visualization, etc.
Have you done this call on NDVITEST layer or some other one? As NDVITEST should only have one result…
Can you copy-paste URL (you can mask instance ID)?

here is url.
https://services.sentinel-hub.com/ogc/fis/088?time=2018-06-09/2018-06-09&MAXCC=5&BINS=20&layer=VEGETATION_INDEX&RESOLUTION=10m&crs=EPSG:4326&geometry=POLYGON%28%28-23.1226237501141+27.835116433823%2C-23.1228443538851+27.8356971858588%2C-23.1231252560092+27.8362901222702%2C-23.1234291320641+27.8366352306342%2C-23.123807392611+27.8369270375218%2C-23.1242669180653+27.8371129194592%2C-23.1248791126317+27.8372386031201%2C-23.1252490807452+27.8372277559912%2C-23.1255777451774+27.8371907925687%2C-23.126177651603+27.8369303578666%2C-23.1266502277617+27.8365232517629%2C-23.1270317622336+27.836023959974%2C-23.1272837708449+27.835372652464%2C-23.1273693864776+27.8347420615911%2C-23.1273133143085+27.834097773548%2C-23.1271685719218+27.8336168975129%2C-23.1269515706328+27.8331922491071%2C-23.126639211748+27.8327871940838%2C-23.1262689418874+27.8324917393143%2C-23.126003788392+27.8323146820855%2C-23.1254221126126+27.8321021514424%2C-23.1247074019977+27.8320257301895%2C-23.1243455265201+27.8321175040553%2C-23.1239666901004+27.8322982931294%2C-23.1237294219804+27.8324267993923%2C-23.1234128248376+27.8326782087861%2C-23.1230533636936+27.8330571418756%2C-23.1228319386662+27.833438572013%2C-23.12262880987+27.8340638713816%2C-23.1225560633875+27.8346860567458%2C-23.1226237501141+27.835116433823%29%29&STYLE=INDEX

For vegetation index getting 3 results.

Thanks

I was right above. You are using visualization layer, so C0, C1 and C2 are Red, Green and Blue components, not something you are looking for.
I created a new layer in the same instanced, called “VEGETATION-INDEX-VALUE”
Try this one.
And read the following FAQ for explanation:
https://www.sentinel-hub.com/faq/how-do-i-get-actual-ndvi-values

Hello,

https://services.sentinel-hub.com/ogc/fis/08870?time=2018-06-09/2018-06-19&MAXCC=5&BINS=20&layer=VEGETATION-INDEX-VALUE&RESOLUTION=10m&crs=EPSG:4326&geometry=POLYGON%28%28-23.1226237501141+27.835116433823%2C-23.1228443538851+27.8356971858588%2C-23.1231252560092+27.8362901222702%2C-23.1234291320641+27.8366352306342%2C-23.123807392611+27.8369270375218%2C-23.1242669180653+27.8371129194592%2C-23.1248791126317+27.8372386031201%2C-23.1252490807452+27.8372277559912%2C-23.1255777451774+27.8371907925687%2C-23.126177651603+27.8369303578666%2C-23.1266502277617+27.8365232517629%2C-23.1270317622336+27.836023959974%2C-23.1272837708449+27.835372652464%2C-23.1273693864776+27.8347420615911%2C-23.1273133143085+27.834097773548%2C-23.1271685719218+27.8336168975129%2C-23.1269515706328+27.8331922491071%2C-23.126639211748+27.8327871940838%2C-23.1262689418874+27.8324917393143%2C-23.126003788392+27.8323146820855%2C-23.1254221126126+27.8321021514424%2C-23.1247074019977+27.8320257301895%2C-23.1243455265201+27.8321175040553%2C-23.1239666901004+27.8322982931294%2C-23.1237294219804+27.8324267993923%2C-23.1234128248376+27.8326782087861%2C-23.1230533636936+27.8330571418756%2C-23.1228319386662+27.833438572013%2C-23.12262880987+27.8340638713816%2C-23.1225560633875+27.8346860567458%2C-23.1226237501141+27.835116433823%29%29&STYLE=INDEX

Can you tell me why the bins are cutting of the values less than the maximum value?
Max is 0.957 and the last bin is 0.93

What is best way to get all covered bins for given geometry?

Thanks