Skip to content

Method to add vertices to a polygon #1481

Description

@dbaston

I don't see a good way to add a set of points to a polygon. For example, union does not add the new vertices:

geosop -a "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))" -b "POINT (5 0)" union
POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))

I extended the GeometrySplitter to handle this:

geosop -a "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))" -b "POINT (5 0)" split
POLYGON ((0 0, 5 0, 10 0, 10 10, 0 10, 0 0))

but this is probably not the right place to do it, since the GeometrySplitter otherwise returns a GeometryCollection. A better place might be the GeometryNoder, but I don't want to mess with that while #1460 is pending.

The whole Noder API doesn't have a concept of points, so the implementation would probably add the explicit nodes to the Noder outputs.

A nice feature of the GeometrySplitter implementation is the snapping of vertices within some epsilon to the ring being split, e.g.

geosop -a "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))" -b "POINT (10.00000000001 5)" split
POLYGON ((0 0, 10 0, 10 5, 10 10, 0 10, 0 0))

Maybe this behavior can be retained.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or feature improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions