Search code examples
javascriptleafletdrawleaflet-geoman

How to make GeoJSON data uneditable through leaflet.pm


I have a geojson file and I get it with ajax. but I want to prevent the editing of the geometries I load during startup. Only the ones that are added with leaflet.pm should be editable. How can i do it ?

leaflet.pm

I'm using geojson coordinate json. these drawings are added to the map when the page loads.

{pmIgnored: true} after trying to delete delete mode when I click on one of the static drawings I added from geojson deletes all of them. How can I prevent it?

var geojsonData;
// addded geojson ajax
$.getJSON("geo.json", {
  async: false,
}, function (data) {
  geojsonData = L.geoJson(data, {
    pmIgnore: true, // ignore static shaped edited
    style: {
      weight: 20
    },
  }).addTo(map);
});

what I want to do is not to delete static coordinates in any way when deletion mode is turned on


Solution

  • I'm Sumit, the maintainer of leaflet.pm

    I think there was a bug regarding ignoring of layers through pmIgnore: true in the global removal mode. It should be fixed in this release. Please test version 2.0.3 or newer and let me know if it works.

    If you still encounter problems, feel free to report it here with a JSFiddle showing the problem and I'm happy to help/fix it.