I have a FeatureCollection from which I remove single Features. I can get the removed feature by adding an event listener pm:remove like following:
layer.on('pm:remove', e => {
// do stuff regarding the removed feature
console.log(e.layer.feature)
});
I would like to also have access to the resulting FeatureCollection (from which the feature has been removed). how can I "console.log()" that?
Are you added the layer to a LayerGroup / FeatureGroup? Then you can call layergroup.toGeoJSON()
Or if you use the default and adding the layers to the map, you can call map.pm.getGeomanLayers(true).toGeoJSON()
.
true
means that it returns a L.FeatureGroup
instead of an array with the layers.