Tuesday, 14 March 2017

wfs t - Using wfs-t in OpenLayers 3?


I'm using OpenLayers-3.6.0 in a web application. I have wfs layer as follow:



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

});

I edit this Point layer as follow:


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

Now I want to save this layer in server side. In OpenLayers-2 we defined a saveStrategy and then call save method of it. It is shown as follows:


var saveStrategy = new OpenLayers.Strategy.Save();


/*
* change layer's features
*/

saveStratefy.save();

How can I do it in OpenLayers-3.6.0?



Answer




Have a look at my blog for a bit on WFS-T. This uses the OL 3.5 library.



https://medium.com/@goldrydigital/wfs-t-with-openlayers-3-16-6fb6a820ac58


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...