无法使用标准代码从Python API访问和下载Sentinel2图像

2024-04-28 22:00:06 发布

您现在位置:Python中文网/ 问答频道 /正文

rec = POLYGON ((597843.23 2977645.792070312, 686175.1025585937 2977645.792070312, 686175.1025585937 3112308.537736816, 597843.23 3112308.537736816, 597843.23 2977645.792070312))
products = api.query(rec,
                     date = ('20191001', '20191031'),
                     platformname = 'Sentinel-2',          
                     cloudcoverpercentage = (0,40)
                    )

对于下载sentinel-2图像的上述代码,我得到以下错误:

KeyError                                  Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/sentinelsat/sentinel.py in _load_subquery(self, query, order_by, limit, offset)

    394             json_feed = response.json()["feed"]
--> 395             if json_feed["opensearch:totalResults"] is None:
    396                
# We are using some unintended behavior of the server that a null is

KeyError: 'opensearch:totalResults'

During handling of the above exception, another exception occurred:

SentinelAPIError                          Traceback (most recent call last)
3 frames
/usr/local/lib/python3.6/dist-packages/sentinelsat/sentinel.py in _load_subquery(self, query, order_by, limit, offset)

    401             total_results = int(json_feed["opensearch:totalResults"])
    402         except (ValueError, KeyError):
403          raise SentinelAPIError("API response not valid. JSON decoding failed.", response)
    404 
    405         products = json_feed.get("entry", [])

SentinelAPIError: HTTP status 200 OK: API response not valid. JSON decoding failed.

我已经阅读了文件,并参考了关于同一错误的类似问题,但无法解决问题


Tags: jsonmostresponsefeed错误opensearchquerysentinel
1条回答
网友
1楼 · 发布于 2024-04-28 22:00:06

多边形值不是坐标

Blockquote

rec=多边形(597843.23 2977645.7920703125.1025585937 2977645.7920703125.686175.1025585937 3112308.537736816、597843.23 3112308.537736816、597843.23 2977645.792070312))

你需要用长纬度值来描述你的多边形

相关问题 更多 >