微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决无法使用标准代码从 Python API 访问和下载 Sentinel-2 图像

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,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.

我已阅读文档并针对同一错误提交了类似问题,但无法解决问题。

解决方法

您的多边形值不是坐标

块引用

REC = POLYGON((597843.23 2977645.792070312,686175.1025585937 2977645.792070312,686175.1025585937 3112308.537736816,597843.23 3112308.537736816,597843.23 2977645.792070312))

您需要用经纬度值描述您的多边形。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。