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

Edit Layers makes browser stop working #729

Open ghost opened 3 years ago

ghost commented 3 years ago

Hello!

I am trying to use this plugin with leaflet but when I am trying to click on the Edit Layers button my browser stop working. Includes Chrome, Opera, and Firefox.

Here is my code:

var m = L.map('map').locate({
        setView: true,       
    }), drawnItems = L.featureGroup().addTo(m);

 m.pm.addControls({
        position: 'topleft'
    });

m.on('pm:create', (e) => {
        var layer = e.layer;
        drawnItems.addLayer(layer);
    });

Any idea why would this happen? Or if some leaflet version is not supported?

Thank you in advance.

Falke-Design commented 3 years ago

I was not able to reproduce this. Can you please create a demo https://jsfiddle.net/o1dwu2vg/

What leaflet Version are you using? Do you use the latest version of geoman 2.8.0?

gavinduffy2 commented 3 years ago

just an FYI, i have the same issue. i simply removed this tool from the toolbar. everything else works fantastic. great plugin.

Falke-Design commented 3 years ago

@gavinduffy2 can you please give me more informations? How many layers are on the map? Only a certain Shape (Marker, Line, Polygon,...)? Are you using some other plugins?

The best would be to have a demo

gavinduffy2 commented 3 years ago

Hi there

I tried not adding some layers to the map, but as soon as I click the edit icon, chrome dies regardless. There is nothing to see in f12, the console fails to open, chrome beng dead

I have a basic OSM base layer and 1 or 2 geojson layers. Sorry I can’t provide much more info.

Falke-Design commented 3 years ago

@gavinduffy2 can you share the geojson layers? Can you reproduce the error, when you adding the geojson to this demo? https://jsfiddle.net/o1dwu2vg/

gavinduffy2 commented 3 years ago

Hi there

I took your sample, it worked fine as is. I added the following code and a reference to jquery to load the attached geojson. Then chrome hangs if I try to edit markup. Confirm you get this as the script tags may spam the email. If I don’t hear from you, I’ll resend without the tags.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>

    // load GeoJSON parcel polys
    var geojsonPolys;
        $.getJSON("maps/nj/parcels/parcel_1339.geojson", function (data) {
            geojsonPolys = L.geoJson(data, { style: styleParcel }).addTo(map);
        });
Falke-Design commented 3 years ago

@gavinduffy2 thx!!! It was possible to reproduce, I will take a look into it, in the next days.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>

// load GeoJSON parcel polys
var geojsonPolys;
$.getJSON("https://raw.githubusercontent.com/scdoshi/us-geojson/master/geojson/state/AK.geojson", function (data) {
    console.log(data);
  //geojsonPolys = L.geoJson(data).addTo(map);
});
gavinduffy2 commented 3 years ago

No worries, glad I could help. Any thoughts on adding a text label control?

Gavin Duffy


From: Falke Design notifications@github.com Sent: Tuesday, March 2, 2021 8:07:41 AM To: geoman-io/leaflet-geoman leaflet-geoman@noreply.github.com Cc: Gavin Duffy gavin@accutitle.com; Mention mention@noreply.github.com Subject: Re: [geoman-io/leaflet-geoman] Edit Layers makes browser stop working (#729)

@gavinduffy2https://github.com/gavinduffy2 thx!!! It was possible to reproduce, I will take a look into it, in the next days.

// load GeoJSON parcel polys var geojsonPolys; $.getJSON("https://raw.githubusercontent.com/scdoshi/us-geojson/master/geojson/state/AK.geojson", function (data) { console.log(data); //geojsonPolys = L.geoJson(data).addTo(map); });

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/geoman-io/leaflet-geoman/issues/729#issuecomment-788672456, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKX2WKP7RXPVHB6LGXRLMG3TBSFD3ANCNFSM4VBYN7CQ.

Falke-Design commented 3 years ago

There is a open Feature Request #332 you can upvote it.