Skip to content

Polygons should require a minimum of 3 vertices #465

Closed
@smeijer

Description

@smeijer

A polygon should have at least 3 vertices to be a valid polygon. A polygon with 2 vertices should be drawn as a line, as 2 points don't make a valid ring.

Point: 1 vertex
Line: 2 vertices
Polyline: 2 or more vertices
Polygon 3 or more vertices

And yet, we check here for a minimum of 2. Can we fix that? Optionally make it configurable to have backward compatibility?

https://github.com/codeofsumit/leaflet.pm/blob/cc69298e6c2d921cec99ea6687debf2b7165c66e/src/js/Draw/L.PM.Draw.Polygon.js#L24-L27

edit, or actually 4. If you also count the closing vertex. A polygon is always circular, where the last vertex equals the first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions