Skip to content

Polygon rings APIΒ #2618

Closed
Closed
@danzel

Description

Currently in polyline.js we have a bunch of TODOs around rings
https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polyline.js#L20

And we have a weirdness with polygon creation that causes issues with leaflet.draw:
Create a polygon with new L.Polygon -> _latlngs is flat [ latLng, latLng, latLng ]
Create a polygon from GeoJson -> _latlngs is nested [ [ latLng, latLng, latLng ] ]

What are your thoughts on the Polyline/Polygon API?

We could change it so internally polygons are always nested and polylines never.
Then expand the api like:
addLatLng: function (latlng, index)
With index defaulting to 0.
By putting the index parameter second, people not using rings won't need to worry.

refs #2290

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions