Skip to main content

I am currently trying to do a request with the Statistical API on a BOYC endpoint.

The endoint is available as a WMS layer, so there is definitly data.

However, I always get:


{
"error": {
"status": 400,
"reason": "Bad Request",
"message": "Processing error.",
"code": "COMMON_EXCEPTION"
}
}

This is my request:

body:


{
"input": {
"bounds": {
"bbox": [1097203.75176, 7306941.069933, 1113874.402104, 7326203.236361],
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/3857"
}
},
"data": [
{ "dataFilter": {}, "type": "byoc-CollectionID" }
]
},
"aggregation": {
"timeRange": {
"from": "2020-03-01T00:00:00Z",
"to": "2020-08-01T23:59:59Z"
},
"aggregationInterval": {
"of": "P30D"
},
"width": 512,
"height": 445.005,
"evalscript": "//VERSION=3\nfunction setup() {\n return {\n input: [\n {\n bands: [\"DM\", \"dataMask\"],\n },\n ],\n output: {\n bands: 2,\n },\n };\n}\nfunction evaluatePixel(samples) {\nreturn {\n data: [samples.DM],\n dataMask: [samples.dataMask],\n };\n}\n"
},
"calculations": {
"default": {}
}
}

evalscript:


//VERSION=3
function setup() {
return {
input: [
{
bands: ["DM", "dataMask"],
},
],
output: {
bands: 2,
},
};
}
function evaluatePixel(samples) {
return {
data: [samples.DM],
dataMask: [samples.dataMask],
};
}

I am testing using Postman.

Hi @blabbath


Yes, it is possible to use BYOC data with Statistical API. You can try it out on requestBuilder. If you login, you should be able to use your BYOC collections, or you can use for instance 120m global mosaic.


You can then see the appropriate curl request, or Python code to be used with sentinelhub-py.



I hope this way you get a better understanding of the error you are encountering. Let me know otherwise.


Hi @gmilcinski ,


is there another way at the moment to query time series from a BYOC collection on CODE-DE? Lets say I have a bbox or geometry and would like to get aggregated values (mean, stdev) for a number of dates in one request.


Thanks a lot.


best wishes,


Patric


Hello @batic,

thank you for your advice! I was using the Request Builder to prepare the code for my question and Postman requests. However I cannot send request using the Builder since my accoutn expired and I don’t have a billing account yet.

Unfortunately the error message is to vague to help me out.

Can you think of any common pitfalls I might have stumbled upon? I am using the collectionId as set in CODE-DE data cube, so if that is correct, can you spot an error in my body or evalscript?

The datasource has only one band called ‘DM’.


Hi @blabbath,

Statistical API is currently not yet working on CODE-DE deployment, as it is still in beta phase (see documentation for more information). Sorry about that.


We have extended your trial until end of the month, so that you can give it a try on our other deployments.


Best,

Grega


Hi @Patric,


on CODE-DE there should the old “FIS” available, which should work with BYOC as well:

31816a827433a291f11f21ff59a3cd94a49b9626.pngsentinel-hub.com
4360130503a7e9abd125dc1335988ba0465771bf.png


FIS - DEPRECATED



The Statistical Info API (FIS), performed elementary statistical computations on remotely sensed data. It has been deprecated, as we developed a new powerful Statistical API.







You will have to configure a configuration in the Configuration utility for this layer, then you can use FIS on this layer.


Best,

Grega


Hi @gmilcinski,


thanks so much for your swift reply!


Maybe I am wrong but, the Code-DE configuration utility allows me to chose endpoints for WMS, WMTS, WCS, WFS, but I cannot find any FIS in the list:


image


Am I missing something?


best wishes,


Patric


This is just because FIS is becoming deprecated. Copy the WMS end-point and simply replace “wms” with “fis”

So something like:


https://code-de.sentinel-hub.com/ogc/fis/<INSTANCE_ID>


@gmilcinski thanks a lot! That works perfectly.


best wishes,


patric


Reply