leaflet-geoman
leaflet-geoman copied to clipboard
Deleting all points in a MultiPolygon or Polygon corrupting coordinates
You can use the hosted geoman for this.
Polygon Use Case
Steps to Reproduce:
- Create a new shape
- Right click to remove all points
Expected results:
- Coordinates set to
[](same as LineString behavior) - OR event fired to denote that this shape should be deleted (same as deleting Point behavior)
Actual results:
- A shape with a single ring containing
null:
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {
"shape": "Polygon",
"name": "Unnamed Layer",
"category": "default"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[null]
]
}
}]
}
MultiPolygon Use Case
Steps to Reproduce:
- Create a new shape
- Use eraser tool to split shape into two
- Right click to remove all points of one of the resulting polygons
Expected results:
- A valid polygon comprised of the remaining shell
Actual results:
- A multi polygon with all null points.
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[null],
[
[null, null],
[null, null]
]
]
},
"properties": {
"shape": "Polygon",
"name": "Unnamed Layer",
"category": "default"
}
}]
}
Thank you for reporting. It sounds like a Leaflet Core issue https://github.com/Leaflet/Leaflet/issues/7627
Fixed in Leaflet Core
@Falke-Design Is an updated version of geoman required for this to work? I've updated my app to Leaflet 1.9.2 but am still getting an error when I try to remove all points after cutting a polygon in half. Trying to figure out whether the issue is on my side or whether I should be patient for an updated version of geoman.

@msereda can you please create a video what are you doing. And it would be very helpful, if you can create a demo: https://jsfiddle.net/o1dwu2vg/
@Falke-Design I can get it via the fiddle if I update leaflet to 1.9.2 (the version in that linked fiddle is 1.6.0).
Will attempt to capture it if I can get the windows tool working, but the steps are pretty simple - create a polygon, cut the polygon in half, then edit & remove all points from one of the resulting two polygons (then 'finish' the edit). You actually get a different error depending on which of the two you remove all points from. https://jsfiddle.net/ja4zy3op/1/
@Falke-Design Video: https://user-images.githubusercontent.com/5561775/196789826-c14dafeb-e3eb-41dc-9c2c-7a632a535e38.mp4
Thank you, I think I found already a solution for this bug