我一直在尝试使用 python 通过 sentinel2 API 获取数据,但我无法通过 geojson 格式获取数据。它不断抛出“SentinelAPIError:HTTP 状态 200 OK:API 响应无效。JSON 解码失败。”
我彻底遵循了文档,但我一直遇到同样的错误。我可以获取点数据,但无法获取 geojson 数据。
我会感谢你在这方面的帮助。这是代码片段。"
if self.boundary.endswith('.geojson'):
footprint = geojson_to_wkt(read_geojson(self.boundary))
products = api.query(footprint,
date=(self.start_date,self.end_date),
platformname = 'Sentinel-2',
cloud_cover= (0,self.cloud_cover))
products_gdf = api.to_geodataframe(products)
"
这是错误。
/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)
4 fr
/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.
谢谢你。