Skip to main content

I am using Process API via python script for downloading third party data. I am able to download specific images. But have few question about the request parameters.


Are height and width in output json post data used only for tile dimensions thereby throttling processing uint? In case I have a larger image shall I skip providing the height and width parameter to download the full image?


How to download the file(s) from the response?

Currently, I am requesting data for a paticular date and saving response.content in a file, What if I provided a bigger timeRange in the request, In that case, the data I expect in the response will be of several days.

How to store that response data of multiple days into the different file(s)?


response = oauth.post('https://services.sentinel-hub.com/api/v1/process',
headers={"Authorization" : "Bearer {}".format(token)},
json={
'input': {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/4326"
},
"bbox": search_bbox
},
"data": [{
"type": "CUSTOM",
"dataFilter": {
"collectionId": collection_id,
"timeRange": {
"from": "2020-10-16T00:00:00Z",
"to": "2020-10-17T00:00:00Z"
}
}
}
]
},
"output": {
"height":512,
"width":512,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
},
"evalscript": """
//VERSION=3
function setup() {
return {
input: [{"bands": ["B4", "B2", "B3", "B1"], units: "DN"}],
output: { id: "default", bands: 4, sampleType: SampleType.UINT16}
};
}
function evaluatePixel(sample) {
return [sample.B3, sample.B2, sample.B1, sample.B4];
}
})
# Saving the response content in tif file
with open('test_out.tif', 'wb') as f:
f.write(response.content)

Hi,

On “height” and “width”:
“height” and “width” define the resolution at which the data will be processed and therefore the number of pixels used for processing. This impacts the memory consumption and execution time. Therefore, processing unit is directly correlated with these two parameters, e.g. “width x height / 512 / 512”.
As described in the API reference, you will have to either use “width and height” or “resx and resy”. Whatever suits you better.
If you want to download full image, we recommend you use resx and resy, so that you do not need to bother about width/height. When providing resx and resy, make sure it is provided in the units of the CRS - e.g. in UTM it should be in meters, in EPSG:4326 it should be in degrees.
There is a maximum limit of 2500x2500 px for the output, so if you need a larger output, we recommend to split the area. Perhaps best to try “Large area utilities” sentinelhub-py function.

On “how to download the file from the response”.
File will be directly outputed in the response, so you simply read the response.

For multi-part response I suggest you check this example

Best


Reply