Skip to main content

Hello,


I would like to know if there is a way (from the sentinel hub dashboard or from somewhere else) to download a set of images from a specific location from a predetermined time interval (from January 1, 2015 to today), selecting a particular satellite band (for example, NDVI). Currently, I only know how to download a specific image (the one being displayed).

Hi,

There are a couple different ways to get to your required output:

a) Using our sentinelhub Python library
One convenient method that utilizes Python functionalities can be seen in Example 8 : Multiple timestamps data in the official documentation of our sentinelhub Python library.

 

b) Handling multitemporal arrays in the evalscript
I would recommend taking a look at our Requests Builder application that offers a user-friendly GUI built on top of Sentinel Hub APIs to help creating your requests. Following the instructions in our beginners guide, you can copy the following example request (that returns a multitemporal array instead of data from a single acquisition) into the Requests Builder:

curl -X POST https://services.sentinel-hub.com/api/v1/process \
-H 'Content-Type: application/json' \
-H 'Authorization: <YourAccessToken>' \
-H 'Accept: application/tar' \
-d '{
"input": {
"bounds": {
"bbox":
12.44693,
41.870072,
12.541001,
41.917096
]
},
"data":
{
"dataFilter": {
"timeRange": {
"from": "2023-05-04T00:00:00Z",
"to": "2023-06-13T23:59:59Z"
}
},
"type": "sentinel-2-l2a"
}
]
},
"output": {
"width": 512,
"height": 343.697,
"responses":
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
},
{
"identifier": "userdata",
"format": {
"type": "application/json"
}
}
]
},
"evalscript": "//VERSION=3\nfunction setup() {\n return {\n input: {\n bands: \"B04\", \"B08\"]\n }],\n output: {bands: 1, sampleType: \"FLOAT32\"},\n mosaicking: Mosaicking.ORBIT\n }\n}\n\nfunction updateOutput(outputs, collection) {\n Object.values(outputs).forEach((output) => {\n output.bands = collection.scenes.length;\n });\n}\n\nfunction updateOutputMetadata(scenes, inputMetadata, outputMetadata) {\n var dates_array = ];\n for (let elem of scenes){\n dates_array.push(elem.date)\n }\n outputMetadata.userData = { \"acquisition_dates\": JSON.stringify(dates_array) }\n}\n\nfunction evaluatePixel(samples) {\n var n_observations = samples.length;\n let ndvi_array = new Array(n_observations).fill(NaN);\n samples.forEach((sample, index) => {\n ndvi_arrayyindex] = (sample.B08 - sample.B04) / (sample.B08 + sample.B04); \n });\n\n return ndvi_array;\n}"
}'

The request updates the number of output bands with the number of available scenes in the specified time range and AOI (function updateOutput). An empty array with the length of available scenes is created and filled with NDVI values in the next step. The requests also returns a JSON file with the list of acquisition dates with the help of the function updateOutputMetadata. There are limitations to how many bands the output TIFF file can handle, so I would suggest sending e.g. annual requests with this method.

I hope this helps!


Reply