Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python API sentinelsat error in query intersect

I'm facing a problem when searching for an image that contains specific coordinates. I can't get the intersect function to work with the API.

I'm getting this error message:

sentinelsat.sentinel.SentinelAPIError: HTTP status 200 OK: Invalid query string. Check the parameters and format.

so how can i get the query to work with intersection ??

Code used:

from sentinelsat import SentinelAPI, read_geojson, geojson_to_wkt
from datetime import date
from shapely.geometry import box, Polygon

api = SentinelAPI('myusername', 'mypassword','https://scihub.copernicus.eu/dhus')

footprint='footprint:"intersects(POLYGON((0 0,1 1,0 1,0 0)))"'

products = api.query(footprint,
                     date=('20180901', date(2018, 9, 3)),
                     area_relation='Intersects',
                     platformname='Sentinel-2',
                     cloudcoverpercentage=(0, 10))

print(products)

#this works  
#api.download_all(products)

Any idea how to solve this?

like image 212
Eslam Salah Avatar asked Sep 05 '18 16:09

Eslam Salah


1 Answers

replace

footprint='footprint:"intersects(POLYGON((0 0,1 1,0 1,0 0)))"'

with

footprint='POLYGON((0 0,1 1,0 1,0 0))'

I don't know if these numbers are just for reference here but there are no results for this Polygon. To see results for another area try

footprint='POLYGON((0 0,1 1,0 1,0 0))'
products = api.query(footprint,
                 date=('20180901', date(2018, 9, 5)),
                 area_relation='Intersects',
                 platformname='Sentinel-2',
                cloudcoverpercentage=(0, 10))

According to official sentinelsat docs, you can select between three different types of area_relation inside your query. I think you should leave footprint only containing the Polygon:

Intersects: true if the AOI and the footprint intersect (default)
Contains: true if the AOI is inside the footprint
IsWithin: true if the footprint is inside the AOI
like image 193
Ioannis Nasios Avatar answered Nov 14 '22 23:11

Ioannis Nasios