Невозможно получить доступ и загрузить изображения Sentinel-2 из Python API со стандартным кодом.

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.

Я прочитал документы и сослался на аналогичные вопросы по той же ошибке, но не смог решить проблему.


person Inshu Chauhan    schedule 25.01.2021    source источник


Ответы (1)


Ваши значения многоугольника НЕ ​​являются координатами

Цитата

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

Вам нужно описать свой многоугольник в значениях долготы и широты.

person Ioannis Nasios    schedule 26.01.2021
comment
Спасибо @Ioannis. Это сработало. Я изменил систему проекции на WGS84, и теперь данные можно загрузить. - person Inshu Chauhan; 27.01.2021