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

Fix invalid geoms #80

Merged
merged 2 commits into from
May 13, 2020
Merged

Fix invalid geoms #80

merged 2 commits into from
May 13, 2020

Conversation

mattijn
Copy link
Owner

@mattijn mattijn commented May 13, 2020

This PR fix #79.

geoms_bad = [
    {
        "type": "MultiPolygon",
        "coordinates": [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]]
    },
    {
        "type": "MultiPolygon",
        "coordinates": [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]]
    }
]

import topojson
tp = topojson.Topology(geoms_bad)
tp
WARNING:root:removed 2 invalid geometric objects
Topology(
{'arcs': [],
 'bbox': [],
 'coordinates': [],
 'objects': {'data': {'geometries': [], 'type': 'GeometryCollection'}},
 'type': 'Topology'}
)

Where the result still can be parsed to the to_geojson() function:

tp.to_geojson()
'{"type": "FeatureCollection", "features": []}'

@mattijn mattijn merged commit eb568e6 into master May 13, 2020
@mattijn mattijn deleted the fix-invalid-geoms branch May 13, 2020 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bounding box not working when using geodata
1 participant