【问题标题】:openlayers, how to get all modified features together from vector sourceopenlayers,如何从矢量源中获取所有修改后的特征
【发布时间】:2019-11-30 12:24:23
【问题描述】:
  1. 我正在尝试在 openlayers 中编辑和保存功能。 这样做时,我被困在一个地方,我想从矢量源所有修改后的特征together。有什么解决办法吗?

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

【问题讨论】:

    标签: openlayers postgis geoserver


    【解决方案1】:

    您必须收听 addfeature removefeature 和 changefeature 事件才能了解并存储功能修改。

    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)。

    【讨论】:

    • 感谢您的回复。它解决了我的查询。但是,我有以下疑问。是否有任何优化和更快的方法来获取所有更新的功能(_state='updated')。
    • 更新时可以在源中存储更新:source._updates.push (e.feature)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多