在OpenLayers中使用wfs-t



我在web应用程序中使用OpenLayers-3.6.0。我有wfs图层如下:

var url="http://localhost:8080/geoserver/wfs?&" + 
      "service=wfs&version=1.1.0&request=GetFeature&typeNames=usa:states";
var format = new ol.format.WFS({});
var source = new ol.source.Vector({
    url: 'proxy.cgi?url='+ encodeURIComponent(url),
    format: format
});
layer wfs = new ol.layer.Vector({
    title: 'states',
    source: source
});

我编辑这个点图层如下:

draw = new ol.interaction.Draw({
    source: source,
    type: 'Point'
});

现在我想把这个图层保存在服务器端。在OpenLayers-2中,我们定义了一个saveStrategy,然后调用它的save方法。如下所示:

var saveStrategy = new OpenLayers.Strategy.Save();
/*
* change layer's features
*/
saveStratefy.save();

如何在OpenLayers-3.6.0中实现?

现在由应用程序代码来处理。Boundless SDK对此有一些代码。请参阅:http://boundlessgeo.com/2014/06/openlayers-editing-wfs-t/以及此存储库中的代码:https://github.com/boundlessgeo/suite/blob/master/sdk/src/main/resources/client/ol3-common/app/TransactionHandler.js

最新更新