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

Deleting all points in a MultiPolygon or Polygon corrupting coordinates #1148

Closed maxmorgan closed 1 year ago

maxmorgan commented 2 years ago

You can use the hosted geoman for this.

Polygon Use Case

Steps to Reproduce:

  1. Create a new shape
  2. Right click to remove all points

Expected results:

Actual results:

MultiPolygon Use Case

Steps to Reproduce:

  1. Create a new shape
  2. Use eraser tool to split shape into two
  3. Right click to remove all points of one of the resulting polygons

Expected results:

Actual results:

{
    "type": "FeatureCollection",
    "features": [{
        "type": "Feature",
        "geometry": {
            "type": "Polygon",
            "coordinates": [
                [null],
                [
                    [null, null],
                    [null, null]
                ]
            ]
        },
        "properties": {
            "shape": "Polygon",
            "name": "Unnamed Layer",
            "category": "default"
        }
    }]
}
Falke-Design commented 2 years ago

Thank you for reporting. It sounds like a Leaflet Core issue https://github.com/Leaflet/Leaflet/issues/7627

Falke-Design commented 2 years ago

Fixed in Leaflet Core

msereda commented 1 year ago

@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.

image

Falke-Design commented 1 year ago

@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/

msereda commented 1 year ago

@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/

msereda commented 1 year ago

@Falke-Design Video: https://user-images.githubusercontent.com/5561775/196789826-c14dafeb-e3eb-41dc-9c2c-7a632a535e38.mp4

Falke-Design commented 1 year ago

Thank you, I think I found already a solution for this bug