Skip to content

Function to check or correct the "orient" of polygons #71

@jorisvandenbossche

Description

@jorisvandenbossche

Shapely has a orient function to make a copy of a Polygon with "proper" orientation of the rings: https://shapely.readthedocs.io/en/latest/manual.html#shapely.geometry.polygon.orient (definition in the code: https://github.com/Toblerity/Shapely/blob/b21a964a56a86cf77c67b477db7e7c2e81d2ccb5/shapely/geometry/polygon.py#L391-L404)

In addition, Shapely also has a is_ccw (is counter clock wise) attribute on LinearRings: https://shapely.readthedocs.io/en/latest/manual.html#object.is_ccw

For this, there is a GEOS C API function: https://github.com/libgeos/geos/blob/eb4da1440836fedf503e1eb2c245595a0f33db5e/capi/geos_c.h.in#L351-L357 (although Shapely implements it manually by calculating the signed area)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestto-GEOSThis issue needs to be solved upstream (in GEOS)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions