Exist image or not

Good morning,

I want to ask how can I check if image exist or not before download it using script of python. (Because everytime I download image and image isn’t exist it is download in black so I need to know first if exist before download it to not have black image).

Also I want to know if it is posible to know if exist collection with same name and coordinate to not create another one with same name and coordinate.

Regards,
Antonio
trueColor.tiff (3.1 KB)
GNDVI.tiff (768.1 KB)

Good morning Antonio,

To check if an image exists or not before running your request, you can make use of our Catalog API. There is also an implementation in Python, since you are already scripting in Python: see the examples in the documentation.

I have problem that i can download image manually using library of python but I can’t using request.save_data(). It is happen to me just in true color in 05/09/2022, just in this date.

Hi Antonio,

Can you provide the code of your request please, so that we can identify the issue?

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”: {
“bbox”: [-5.7585989, 37.3886755, -5.7565442, 37.3910112],
“geometry”: {
“type”: “Polygon”,
“coordinates”: [
[
[-5.7580946,37.3905082],
[-5.7579981,37.3903292],
[-5.7585989,37.3902355],
[-5.7585453,37.3893489],
[-5.7583629,37.3886755],
[-5.7573811,37.3887778],
[-5.7565442,37.3910112],
[-5.7580946,37.3905082]
]
]

},
"data": [
  {
    "dataFilter": {
      "timeRange": {
        "from": "2022-10-02T00:00:00Z",
        "to": "2022-11-02T23:59:59Z"
      }
    },
    "type": ""
  }
]

},
“output”: {
“width”: 512,
“height”: 343.697,
“responses”: [
{
“identifier”: “default”,
“format”: {
“type”: “image/jpeg”
}
}
]
},
“evalscript”: “//VERSION=3\n\nfunction setup() {\n return {\n input: [“B02”, “B03”, “B04”],\n output: { bands: 3 }\n };\n}\n\nfunction evaluatePixel(sample) {\n return [2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02];\n}”
}’

Could you please help me better understand what issue you are running into? I ran your CURL request above and got an image back. You referred to the Python package in your previous post: does this mean that your CURL request runs but you cannot get the images with Python? If so, do you have the Python code you are using?

I get the image in my collection “My PlanetScope 8-band data” at 05/09/2022 in white. The problem just in day 05/09/2022 that I get it white using planetScope in python and also using request builder.
I want to know the reason why please. (The rest of other days I get the image correctly). I upload the img is in white.

image

Thanks.

Thanks for the clarification, it was not clear to me that you were talking about Planet Scope. After looking: it seems there were no acquisitions on the 5th September 2022. Hence why you don’t get data.