Esl*_*lah 5 python api intersect sentinelsat
我在搜索包含特定坐标的图像时遇到问题。我无法让 intersect 函数与 API 一起使用。
我收到此错误消息:
sentinelsat.sentinel.SentinelAPIError: HTTP status 200 OK: Invalid query string. Check the parameters and format.
Run Code Online (Sandbox Code Playgroud)
那么我怎样才能让查询与交集一起工作?
使用的代码:
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)
Run Code Online (Sandbox Code Playgroud)
知道如何解决这个问题吗?
replace
footprint='footprint:"intersects(POLYGON((0 0,1 1,0 1,0 0)))"'
Run Code Online (Sandbox Code Playgroud)
with
footprint='POLYGON((0 0,1 1,0 1,0 0))'
Run Code Online (Sandbox Code Playgroud)
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))
Run Code Online (Sandbox Code Playgroud)
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:
Run Code Online (Sandbox Code Playgroud)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