Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planet get_items method crashes with planet==2.7 #920

Closed
dfguerrerom opened this issue May 22, 2024 · 1 comment · Fixed by #937
Closed

planet get_items method crashes with planet==2.7 #920

dfguerrerom opened this issue May 22, 2024 · 1 comment · Fixed by #937
Projects

Comments

@dfguerrerom
Copy link
Collaborator

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
Copy link
Collaborator Author

planet version has been pinned: 0e90174... I need to test if the problem persists with newer versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant