openlayers,如何从矢量源中获取所有修改后的特征

openlayers, how to get all modified features together from vector source

  1. 我正在尝试在 openlayers 中编辑和保存要素。 在这样做的同时,我被困在一个地方,我想从矢量源中获得 all 修改的特征 together。有什么解决办法吗?

  2. 还建议我如何使用 openlayers、geoserver、postgis 实现功能审计功能。有可用的解决方案吗?

您必须收听 addfeature removefeaturechangefeature 事件以获取通知并存储功能修改。

source.on ('changefeature', (e) => {
  // e.feature has changed
  // do something with it...
  e.feature._state = 'update';
});

查看 WFS-T 并作为 writeTransaction 将修改发送到服务器 (https://openlayers.org/en/latest/apidoc/module-ol_format_WFS-WFS.html)。