Skip to main content

I am using the Barren Soil index and want to count the pixel above and below a certain threshold.

I tried to use the FIS API and bins, bit the minimum number of bins is 4 and no way to set just 2 bins with a threshold.

I want to count the total area in a polygon that is soil and compare that number over time.

Any recommendations?

One way is probably to integrate the threshold directly in the custom script, i.e.:
if (val> threhold) return [1]; else return [0];

If I remember correctly, you can then use bins=4 in FIS and still get only two bins.


The better way would be to make use of Statistical API, where you can define custom bins:

docs.sentinel-hub.com
4360130503a7e9abd125dc1335988ba0465771bf.png


Statistical API



Our powerful Statistical API makes it possible to get various statistics for satellite imagery without having to download images.








Thanks for your feedback, seems to be working well,

But I find the count result of the FIS bins to be strange.

I set the resolution to be 10m, so the total count from both 0 and 1 should equal to total size of the polygon, but it does not add up.

I would assume of my polygon is .01 sq KM, I would expect to have a total count of 10000. Am I reasonable to assume this calculation?


It should be like this, yes. There might be some discrepancy if your polygon is not aligned with the UTM grid, i.e. the pixels on the border might sometimes fall in and sometimes not.


Reply