I'm using the Leaflet.draw library to allow in map editing of geojson shapes. On multipolygon types though, I get the error message TypeError: layer.options is undefined
from the library.
This looks like the same issue referenced here. Is there a workaround for this that allows drawing, editing, and deleting multipolygon type geojson?
My workaround is just splitting the MultiPolygon
type geojson into several Polygon
s.
if (shape.type === "MultiPolygon") {
shape.coordinates.forEach(function(shapeCoords, i) {
var polygon = {type:"Polygon", coordinates: shapeCoords};
L.geoJson(polygon, {
onEachFeature: function (feature, layer) {
featureGroup.addLayer(layer);
}
});
});
}