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)