in the project i am working on, i should calculate the ndvi
for all satellite missions.
i know how to structure and build the request, but it seems the evalscript
through which the ndvi
is calculated differs according to the selected satellite mission.
my question is, can i refer to EO Browser
and copy the evalscript
from it? i mean, one can check the evalscript
used in the latterly mentioned link, can i simply copy the evalscript
from it and paste it in my code?! is that possible
It is unlikely to work since the EO Browser script includes some other outputs for additional functionality specific to the browser.
Your best bet is to get a very simple NDVI evalscript, like under the Raw tab in the custom scripts repository Normalized difference vegetation index | Sentinel Hub custom scripts
And then replace the input bands in the script. The same custom script page also shows you which bands are used for other satellites.
thanks
i referred to the link you posted in your answer, however, i could not find info about sentinel-3
and sentinel-5
aren’t they able to get ndvi
vlaues?!
Sentinel-5 isn’t able to produce NDVI. For Sentinel 3 it is:
(B17 - B08) / (B17 + B08)
thanks
but would you please tell me where did get this infor?
i checked this link but i could not find it
thanks
NDVI needs a Red and NIR band. Check the available bands for the sensor you want to use (S5P listed here Sentinel-5P L2) and see if they have a red and NIR band. If not, calculating NDVI is not possible.
would you please tell me why the following evalscript
does not work for sentinelhub-3
const evalscript = `//VERSION=3
function setup() {
return{
input: [{
bands: ["B08", "B17"]
}],
output: {
id: "default",
bands: 1,
sampleType: SampleType.FLOAT32
}
}
}
function evaluatePixel(sample) {
let ndvi = (sample.B17 - sample.B08) / (sample.B17 + sample.B08)
return [ ndvi ]
}`;
You have to use Sentinel 3 OLCI
yes, i was using the identifier sentinel-3-olci
as shown in the below posted request,…it does not work even in the request-builder
request:
"input": {
"bounds": {
"geometry": {
"type": "Polygon",
"coordinates": :
1445883.5319464942,
6569386.912474411
],
1443278.0408928054,
6557300.32588317
],
1461009.851474265,
6565840.548767853
],
1445883.5319464942,
6569386.912474411
]
]
]
},
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/3857"
}
},
"data": :
{
"dataFilter": {
"timeRange": {
"from": "2022-01-01T00:00:00Z",
"to": "2022-01-16T23:59:59Z"
}
},
"type": "sentinel-3-olci"
}
]
},
"output": {
"width": 512,
"height": 348.742,
"responses": :
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
},
"evalscript": "//VERSION=3\n function setup() {\n return{\n input: :{\n bands: :\"B08\", \"B17\"]\n }],\n output: {\n id: \"default\",\n bands: 1,\n sampleType: SampleType.FLOAT32\n }\n }\n }\n \n function evaluatePixel(sample) {\n let ndvi = (sample.B17 - sample.B08) / (sample.B17 + sample.B08)\n return n ndvi ]\n }"
Does it show an error?
in the request-builder
it says something went wrong
and in my code, i receive bad-request
For me your request works.
Can you try this request:
curl -X POST https://creodias.sentinel-hub.com/api/v1/process \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ' \
-d '{
"input": {
"bounds": {
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
1445883.5319464942,
6569386.912474411
],
[
1443278.0408928054,
6557300.32588317
],
[
1461009.851474265,
6565840.548767853
],
[
1445883.5319464942,
6569386.912474411
]
]
]
},
"properties": {
"crs": "http://www.opengis.net/def/crs/EPSG/0/3857"
}
},
"data": [
{
"dataFilter": {
"timeRange": {
"from": "2022-01-01T00:00:00Z",
"to": "2022-01-16T23:59:59Z"
}
},
"type": "sentinel-3-olci"
}
]
},
"output": {
"width": 512,
"height": 348.742,
"responses": [
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
},
"evalscript": "//VERSION=3\n function setup() {\n return{\n input: [{\n bands: [\"B08\", \"B17\"]\n }],\n output: {\n id: \"default\",\n bands: 1,\n sampleType: SampleType.FLOAT32\n }\n }\n }\n \n function evaluatePixel(sample) {\n let ndvi = (sample.B17 - sample.B08) / (sample.B17 + sample.B08)\n return [ ndvi ]\n } "
}'
Morning
the code you posted worked for me, while the same code with a change in the coordinates does not work.
it seems that there are some locations for which there is no data available from “sentinel-3-olci”. is that true please? if yes, how can i know the covered locations for which there are available data for each repective satellite? is that possible?
That is true, you can use the Catalog API to check what is available. For more general information please check with the satellite owner directly (ESA).
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.