geoman-io / leaflet-geoman

🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
https://geoman.io
MIT License
2.21k stars 433 forks source link

this._layer.getLatLngs(...).flat is not a function URL #1175

Closed FRANKSADWAR closed 2 years ago

FRANKSADWAR commented 2 years ago

Hello, I am using Geoman (my first time), adding the plugin was not a problem, so I added controls such that at one instance one can only use a single drawing feature such as drawCircle, drawMarker, etc., but when it came to drawPolygon and drawPolyline, encountered this issue. How can go about this? Is there any on map click events that could be the cause?

Falke-Design commented 2 years ago

Can you please share a demo? It looks like you are defining a polygon without an array of latlngs:

L.polygon(null)

instead of the correct one

L.polygon([])
FRANKSADWAR commented 2 years ago

Thanks, I found out that on extracting coordinates, latlngs have to be an array of points https://leafletjs.com/reference.html#polygon