I’m trying to donwload sentinel-2 images by using the sentinelsat library with python, however I’m getting 0 available images. I tried creating a shapefile with a polygon using QGIS and then converting it to a geojson and also I used this (https://geojson.io/) webpage to get my desire geojson however I tried two different geojson files and nothing happens, but when I draw a bounding box by using the webpage https://scihub.copernicus.eu/dhus on there, there are available images it had the same region of interest of my geojson.
I also tested changing the date format from: 2022-06-10 00:00:00 to 20220610 and the problem remains, I would like that someone test my code, I don’t know if there are problems.
from sentinelsat import SentinelAPI, read_geojson, geojson_to_wkt from datetime import datetime, timedelta api = SentinelAPI('xxx', 'xxxx') footprint = geojson_to_wkt(read_geojson('poligono.geojson')) # date_ = "20220510" date_event = datetime.strptime("2022-05-10","%Y-%m-%d") date_start_search = date_event date_end_search = date_start_search + timedelta(days=11) print(date_start_search) # 2022-05-10 print(date_end_search) # 2022-05-10 products = api.query(footprint, producttype='S2MSI1C', orbitdirection='ASCENDING', date = (date_start_search, date_end_search), platformname = 'Sentinel-2', processinglevel = 'Level-2A', cloudcoverpercentage = (0, 10), limit=10) if len(products) > 0: print("There are images availables = " + str(len(products))) else : print("There is not available images, change date.") path="images" api.download_all(products, directory_path=path)
This is my polygon in QGIS which was exported to geojson, and the script returns 0 images.
And this is the bounding box draw in the copernicus webpage and when I search it returns available items:
¿Is necessary a rectangle polygon?
Why I’m not getting images if my polygons are similiar?
When I tested my geojson from QGIS with the next code:
footprint = geojson_to_wkt(read_geojson('poligono.geojson')) products = api.query(footprint, producttype='SLC', orbitdirection='ASCENDING', limit=1) api.download_all(products)
it works, and I’m getting one image because I setted a limit of 1, but I need set and specific rage of date and cloud coverage percentage, this last code is not optimus for a reponsible search, I think that this is a lucky search, and there is not filters. ¿Why this last code works and the first not?.
I will appreciate any idea to fix this problems dears,
thanks so much.
My code works and found some images when I avoid:
And changing orbitdirection=‘ASCENDING’ to orbitdirection=‘DESCENDING’
Now how I can know if this images are from producttype S2MSI1C, S2MSI2A or S2MSI2Ap?