Skip to main content

Hello,


I’m downloading raw bands in request builder and with an specific AOI (Kml file) I’ve got the result with a rectangle covering the area I dont need to. please can you advice how to delete/ dont get it?


this is the evalscript I use:


curl -X POST https://services.sentinel-hub.com/api/v1/process \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>\
-d '{
"input": {
"bounds": {
"geometry": {
"type": "Polygon",
"coordinates": s


-60.51326738818213,
-34.59147445827685,
0
],

-60.51536789035015,
-34.58982117959025,
0
],

-60.51556849369157,
-34.58976364023773,
0
],

-60.51594728379507,
-34.59022133394414,
0
],

-60.5160052548891,
-34.59020023932253,
0
],

-60.5156555299544,
-34.58957290691022,
0
],

-60.51648339062525,
-34.58892137725146,
0
],

-60.51681594737629,
-34.58870972941776,
0
],

-60.51758091766428,
-34.58974506124034,
0
],

-60.51778857341287,
-34.58995926497632,
0
],

-60.51779056472827,
-34.59004884579127,
0
],

-60.51753497550269,
-34.59019915993736,
0
],

-60.51711325334332,
-34.5897792590314,
0
],

-60.51700609565026,
-34.58982980476674,
0
],

-60.51686988478428,
-34.58983809846497,
0
],

-60.51674489315493,
-34.58986167199643,
0
],

-60.51668044743071,
-34.58990818922639,
0
],

-60.51666360722821,
-34.58996869700518,
0
],

-60.51669687235691,
-34.59008368146566,
0
],

-60.51657622501247,
-34.59010066440789,
0
],

-60.51642291046056,
-34.59001716882023,
0
],

-60.51637406158192,
-34.59006555009502,
0
],

-60.51632011785643,
-34.59012967878955,
0
],

-60.51631461026375,
-34.59019044628002,
0
],

-60.51626218726935,
-34.59029585763776,
0
],

-60.51613116099967,
-34.59032540316122,
0
],

-60.51604970866502,
-34.59044883340062,
0
],

-60.51611365189559,
-34.59055724682759,
0
],

-60.51590934052724,
-34.59074477546627,
0
],

-60.51557924314405,
-34.59102596090509,
0
],

-60.51544106179377,
-34.59108521666631,
0
],

-60.51542402508802,
-34.59118964811019,
0
],

-60.51528121278618,
-34.59134246440112,
0
],

-60.51518934454199,
-34.5915114018002,
0
],

-60.51508532477904,
-34.59168355864681,
0
],

-60.51512103502825,
-34.59174776937908,
0
],

-60.51519418054942,
-34.59183638360368,
0
],

-60.5151849738231,
-34.59197046562929,
0
],

-60.51460148484549,
-34.59234478190861,
0
],

-60.51326738818213,
-34.59147445827685,
0
]
]
]
}
},
"data": a
{
"dataFilter": {
"timeRange": {
"from": "2022-11-24T00:00:00Z",
"to": "2022-11-24T23:59:59Z"
}
},
"type": "sentinel-2-l2a"
}
]
},
"output": {
"width": 41.45200722251264,
"height": 40.465219228861905,
"responses": s
{
"identifier": "default",
"format": {
"type": "image/tiff"
}
}
]
},
"evalscript": "VERSION=3\nfunction setup() {\n return {\n input: u{\n bands: d\"B01\", \"B02\", \"B03\", \"B04\", \"B05\", \"B06\", \"B07\", \"B08\", \"B8A\", \"B09\", \"B11\", \"B12\"],\n units: \"DN\"\n }],\n output: {\n id: \"default\",\n bands: 12,\n sampleType: SampleType.UINT16\n }\n }\n}\n\nfunction evaluatePixel(sample) {\n return u sample.B01, sample.B02, sample.B03, sample.B04, sample.B05, sample.B06, sample.B07, sample.B08, sample.B8A, sample.B09, sample.B1972, sample.B12]\n}\n\n"
}'

Hi Magdalena,


Yes as it is a GeoTIFF the response will be for the bounding box encompassing the AOI that you specify. You can assign a no data value to the pixels outside your AOI using the following in your evalscript:


VERSION=3
function setup() {
return {
input: [{
bands: ["B01", "B02", "B03", "B04", "B05", "B06", "B07", "B08", "B8A", "B09", "B11", "B12", "dataMask"],
units: "DN"
}],
output: {
id: "default",
bands: 13,
sampleType: SampleType.UINT16
}
}
}

function evaluatePixel(sample) {
return [sample.B01, sample.B02, sample.B03, sample.B04, sample.B05, sample.B06, sample.B07, sample.B08, sample.B8A, sample.B09, sample.B11, sample.B12, sample.dataMask]
}

In this example, there is an additional input and output band sample.dataMask. you can use the values in the dataMask as the transparency band.


For more information, you can refer to the documentation here with further examples.


Hope this helps you out 👍


Thanks William, we’ve checked the info very carefully but still we don’t know how to obtain the raster band without this pixels with NO data value we don’t need and this is making the next steps in the process take this area into account when it should not be…any ideas? someone else maybe facing the same situation? I think it is a common way to work with QGIS and now we are migrating our process to a web platform using your API for obtain Sentinel 2 images, but with this result we cannot continue 😞.

Thanks for any help!

Magda


As I stated:



the response will be for the bounding box encompassing the AOI that you specify.



Therefore, the API reference will always be for a bounding box, the pixels outside the area of interest will be no data values, however. I’m not sure whether you are performing additional analysis or whether you need the image clipped to the AOI for visualisation purposes, maybe you are able to elaborate further on this?


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.


Reply