leaflet-geoman: Error while edit layer
Hi, I’m getting error when I do the following steps with geoman drawing tool.
- load existing geometry into $LayerDrawItems group Layer
- edit the loaded geometry by edit layer button
let $LayerDrawItems = new L.FeatureGroup();
Map.addLayer($LayerDrawItems);
_**Load existing geometry and attach to drawing tool at initial page load**_
L.Proj.geoJson(data, {
onEachFeature: function (feature, layer) {
layer.groupName = "editBoundary";
layer.options.snapIgnore = true;
$LayerDrawItems.addLayer(layer);
}
});
_**Create Layer Event**_
function Create (e) {
debugger;
let layer = e.layer, type = e.shape;
layer.groupName = layer.options.groupName;
}
_**Configurations**_
var drawOptions = {
snappable: true, snapDistance: 20, snapMiddle: true, allowSelfIntersection: false,
cursorMarker: true,
finishondoubleclick: true,
layerGroup: $LayerDrawItems
};
Map.pm.setGlobalOptions(drawOptions)
Map.pm.Draw.Polygon.setPathOptions({ opacity: 0.7, weight: 2, snapIgnore: true, groupName:"editBoundary"});
Map.pm.Draw.Rectangle.setPathOptions({ opacity: 0.7, weight: 2, snapIgnore: true, groupName: "editBoundary" });
Map.pm.Draw.Line.setPathOptions({ opacity: 0.7, weight: 2, snapIgnore: true, groupName: "editBoundary" });
Map.pm.Draw.Circle.setPathOptions({ opacity: 0.7, weight: 2, snapIgnore: true, groupName: "editBoundary" });
Map.pm.disableDraw();
Map.pm.addControls({ editMode: true, oneBlock: true, cutPolygon: false, drawCircleMarker: false });
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 24
I don’t think so as there are a few extra functionality exists in geoman like multi-geometry, snapping, drag geometry, which makes this tool more attractive to use it. hopefully the bug will get resolved once I update with the latest leaflet version. I will let you know the outcome of version upgrade.