Skip to content

Automatic conversion between geometry types #73

@evetion

Description

@evetion

On Slack, @jaakkor2 provided this:

import GeoJSON, LibGEOS
a = """{"type": "FeatureCollection", "features": [
    {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [0.0, 0.0]]]}}
    ]}"""
poly1 = GeoJSON.read(a)[1].geometry
LibGEOS.area(poly1)    # fails

Note the assumption that geometries "just work" without conversion. Is that something we could do better? Means mostly that we don't just provide a convert, but also to automatically take the correct type to convert into. A GeoJSON.Polygon becomes a LibGEOS.Polygon automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions