Python 哨兵。HTTP状态200正常:API响应无效。JSON解码失败

Python 哨兵。HTTP状态200正常:API响应无效。JSON解码失败,python,gis,satellite,sentinel2,sentinelsat,Python,Gis,Satellite,Sentinel2,Sentinelsat,我一直试图用python通过Sentinel2API获取数据,但无法通过geojson格式获取数据。它不断地抛出一个错误 “SentinelAPIError:HTTP状态200 OK:API响应无效。JSON解码失败。” 我彻底地遵循了文档,但还是不断地出现同样的错误。我可以获取点数据,但无法获取geojson数据 我将感谢你在这方面的帮助。下面是代码片段。 " " 这里是错误 /usr/local/lib/python3.6/dist-packages/sentinelsat/sentine

我一直试图用python通过Sentinel2API获取数据,但无法通过geojson格式获取数据。它不断地抛出一个错误 “SentinelAPIError:HTTP状态200 OK:API响应无效。JSON解码失败。”

我彻底地遵循了文档,但还是不断地出现同样的错误。我可以获取点数据,但无法获取geojson数据

我将感谢你在这方面的帮助。下面是代码片段。 "

"

这里是错误


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

谢谢。

您的.geojson文件似乎无法解码。 首先检查已创建文件的编码语言。如果这没用

检查您的.geojson格式是否与以下格式类似:

{ “类型”:“FeatureCollection”, “特点”:[ { “类型”:“功能”, “属性”:{}, “几何学”:{ “类型”:“多边形”, “坐标”:[ [ [ 23.642578125, 37.93553306183642 ], [ 23.8018798828125, 37.93553306183642 ], [ 23.8018798828125, 38.026458711461245 ], [ 23.642578125, 38.026458711461245 ], [ 23.642578125, 37.93553306183642 ] ] ] } } ] }


您可以在页面中快速生成.geojson文件。

您的.geojson文件似乎无法解码。 首先检查已创建文件的编码语言。如果这没用

检查您的.geojson格式是否与以下格式类似:

{ “类型”:“FeatureCollection”, “特点”:[ { “类型”:“功能”, “属性”:{}, “几何学”:{ “类型”:“多边形”, “坐标”:[ [ [ 23.642578125, 37.93553306183642 ], [ 23.8018798828125, 37.93553306183642 ], [ 23.8018798828125, 38.026458711461245 ], [ 23.642578125, 38.026458711461245 ], [ 23.642578125, 37.93553306183642 ] ] ] } } ] }


您可以在页面中快速生成.geojson文件。

结果表明,我的问题是没有使用为API创建的正确变量。我写了
self.cloud\u cover
,当时它应该是
self.cloudcoverpercentage
。我在文档中跳过了它。

原来我的问题是没有使用为API创建的正确变量。我写了
self.cloud\u cover
,当时它应该是
self.cloudcoverpercentage
。这是我在文档中跳过的。

简单地说,它获取的字典没有键
opensearch:totalResults
简单地说,它获取的字典没有键
opensearch:totalResults
谢谢您的回复。我的问题是,我没有使用为API创建的正确变量。我写了
self.cloud\u cover
,本来应该是
cloudcoverpercentage
。谢谢你的回复。我的问题是,我没有使用为API创建的正确变量。我写了
self.cloud\u cover
,本来应该是
cloudcoverpercentage

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