Can you share the process API request that you do?
Sure, here it is:
url = "https://services.sentinel-hub.com/api/v1/process"
headers = {
'Accept': '*/*',
'Content-Type': 'application/json',
'Authorization': f'Bearer {token["access_token"]}',
'Origin': 'https://apps.sentinel-hub.com',
'Connection': 'keep-alive',
'TE': 'Trailers'
}
script_str_json = """
//VERSION=3
function setup() {
return {
input: ["B02", "B03", "B04"],
mosaicking: Mosaicking.ORBIT,
output: { id:"default", bands: 3}
}
}
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
outputMetadata.userData = { "metadata": JSON.stringify(scenes) }
}
function evaluatePixel(samples) {
return [ 2.5*samples[0].B04, 2.5*samples[0].B03, 2.5*samples[0].B02 ]
}
"""
payload = get_payload(strt_dt, end_dt, "application/json", script_str_json)
I use this evalscript i.e. script_str_json
to get the metadata and extract the correct date of the file.
Can you send the request part as well, you’ve just submitted the evalscript.
I have used your evalscript in a combination with request described in this part:
docs.sentinel-hub.com
Use these CURL and Postman examples to access atmospherically corrected Sentinel-2 L2A data with Sentinel Hub API.
And it works for me.
Sure, here is the payload:
def get_payload(strt_dt, end_dt, resp_type, evalscript):
payload = {
"input":{
"bounds":{
"geometry":{
"type": "Polygon",
"coordinates": COORDINATES
},
"properties":{
"crs":"http://www.opengis.net/def/crs/EPSG/0/32719"}},
# "crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"}},
"data":[{
"dataFilter":{
"timeRange":{
"from":strt_dt,
"to":end_dt
},
"maxCloudCoverage":100,
"previewMode":"EXTENDED_PREVIEW"},
"processing":{"upsampling":"BICUBIC"},
"type":TYPE}]},
"output":{"resx":10,"resy":10,
"responses": [
{
"identifier": "default",
"format": {
"type": resp_type
}
}
]
}, "evalscript": evalscript
}
return payload
payload = get_payload(strt_dt, end_dt, "application/json", script_str_json)
res = requests.request("POST", url, headers=headers, data = json.dumps(payload), timeout=10)
I am trying to reproduce your error, but I am not able to. It works for me.
Can you send an actual example of the request, with filled values (you’ve sent a proto-request).