0

我有一个 FeatureCollection 从中删除单个功能。我可以通过添加事件侦听器pm:remove来获取已删除的功能,如下所示:

layer.on('pm:remove', e => {
    // do stuff regarding the removed feature
    console.log(e.layer.feature)
});

我还想访问生成的 FeatureCollection(已从中删除该功能)。我怎么能“ console.log() ”呢?

4

1 回答 1

1

您是否将图层添加到图层组/功能组?然后你可以打电话layergroup.toGeoJSON()

或者,如果您使用默认设置并将图层添加到地图,您可以调用map.pm.getGeomanLayers(true).toGeoJSON(). true意味着它返回 aL.FeatureGroup而不是带有图层的数组。

于 2021-01-13T13:34:56.517 回答