planet get_items method crashes with planet==2.7
dfguerrerom opened this issue · 1 comments
dfguerrerom commented
Something has changed in the logic of the the latest release of planet (2.7) and it crashes the get_items
method from planet.
to test:
planet_model = PlanetModel(planet_key)
aoi = { # Yasuni national park in Ecuador
"type": "Polygon",
"coordinates": (
(
(-75.88994979858398, -1.442146588951299),
(-75.9041976928711, -1.4579343782400327),
(-75.88651657104492, -1.476982541739627),
(-75.85647583007812, -1.4534726228737347),
(-75.88994979858398, -1.442146588951299),
),
),
}
start = "2020-11-18"
end = "2020-11-19"
cloud_cover = 0.5
# Get the items
items = planet_model.get_items(aoi, start, end, cloud_cover)
items = hide_key(items, planet_key) # hide the key in the produced file
File [~/.local/lib/python3.10/site-packages/planet/geojson.py:135](http://localhost:8888/home/dguerrero/.local/lib/python3.10/site-packages/planet/geojson.py#line=134), in geom_from_geojson(data)
133 features = data['features']
134 except KeyError:
--> 135 raise GeoJSONError(f'Invalid GeoJSON: {data}')
137 if len(features) > 1:
138 raise GeoJSONError(
139 'FeatureCollection has multiple features. Only one feature'
140 ' can be used to get geometry.')
GeoJSONError: Invalid GeoJSON: {'type': 'AndFilter', 'config': [{'type': 'GeometryFilter', 'field_name': 'geometry', 'config': {'type': 'Polygon', 'coordinates': (((-75.88994979858398, -1.442146588951299), (-75.9041976928711, -1.4579343782400327), (-75.88651657104492, -1.476982541739627), (-75.85647583007812, -1.4534726228737347), (-75.88994979858398, -1.442146588951299)),)}}, {'type': 'RangeFilter', 'field_name': 'cloud_cover', 'config': {'lte': 0.5}}, {'type': 'DateRangeFilter', 'field_name': 'acquired', 'config': {'gt': '2020-11-18T00:00:00Z'}}, {'type': 'DateRangeFilter', 'field_name': 'acquired', 'config': {'lt': '2020-11-19T00:00:00Z'}}]}
dfguerrerom commented
planet version has been pinned: 0e90174... I need to test if the problem persists with newer versions