Show script or download{:target="_blank"} it or download V3{:target="_blank"} for use with Sentinel Hub RESTful API.
Sentinel Hub RESTful API (click to expand)
Save script_v3.js to your current directory and run the below command. Don't forget to insert your actual access token.
curl -X POST \
https://services.sentinel-hub.com/api/v1/process \
-H 'Authorization: Bearer <your_access_token>' \
-F 'request={
"input": {
"bounds": {
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/4326"
},
"bbox": [14.4,45.95,14.6,46.15]
},
"data": [{
"dataFilter": {
"maxCloudCoverage": 20,
"timeRange": {
"from": "2015-01-01T00:00Z",
"to": "2019-10-10T00:00Z"
}
},
"type": "S2L1C"
}]
},
"output": {
"width": 512,
"height": 512,
"responses": [{
"identifier": "default",
"format": { "type": "image/png" }
}]
}
}' \
-F "evalscript=@script_v3.js" --output output.png
The vegetation condition index [1] compares the NDVI at current (observed) time to historical values, i.e. to NDVI at similar dates in previous years:
VCI = (NDVI_observed - NDVI_hist_min) / (NDVI_hist_max - NDVI_hist_min)
Please note that in case of Sentinel 2, only a few years of history are available.
The script takes the newest (latest) available scene as the observed one -- thus, the observed date can be chosen in the Sentinel Hub Playground GUI (or, in case of API request, via the dataFilter.timeRange.to
field). Then, for each previous year the script finds the one closest to the same date, but not more than toleranceDays
from that date.
Because of the multi-temporal nature of this index, be sure to use it in the temporal version of Sentinel Hub Playground with "Enable temporal data" checked in the "Effects" tab, or in case of API request, set the dataFilter.timeRange.to
field far enough back to include all available history.
The actual scenes (dates) used can be returned as meta-data (click to see details).
Meta-data can be retrieved with an API requests by replacing the responses
part of the request with:
"responses": [{
"identifier": "userdata",
"format": { "type": "application/json" }
}]
Example response:
{
"historical": [
"2018-09-08T00:00:00.000Z",
"2016-09-13T00:00:00.000Z",
"2015-09-09T00:00:00.000Z"
],
"observed": "2019-09-13T00:00:00.000Z"
}