Hello all,
I am a very newbie using the Sentinelhub API. I currently have requested imagery of Pleiades, and I am trying to download it through the Sentinel Hub Python package by using the following code:
So my question is, how can I download it to my disk in a tiff format?
(I have already imported the libraries and set my credentials),*
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/{}".format(4326)
},
"bbox": [-46.74869460121712, -0.9729251789917431, -46.64665760474313, -0.889532997887468]
},
"data": [{
"type": "CUSTOM",
"dataFilter": {
"collectionId": collectionid,
"timeRange": {
"from": "2017-06-16T00:00:00Z",
"to": "2017-12-17T00:00:00Z"
}
}
}]
},
"output": {
'resx': 0.0000938,
'resy': 0.0000938,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
},
"evalscript": """
//VERSION=3
function setup() {
return {
input: [{"bands": ["B0", "B1", "B2", "B3"], units: "DN"}],
output: { id: "default", bands: 4, sampleType: SampleType.UINT16}
};
}
function evaluatePixel(sample) {
return [sample.B0, sample.B1, sample.B2];
}
"""
})
#Saving the response content in tif file
with open(‘test_out.tif’, ‘wb’) as f:
f.write(response.content)