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?
2 Answers 2
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
-
Please include here at least a summary of the contents of the blog post of yours that you are proposing as a link-only answer here.2018年10月24日 21:18:00 +00:00Commented Oct 24, 2018 at 21:18
-
Avoid overt self-promotion. The community tends to vote down overt self-promotion and flag it as spam. Post good, relevant answers, and if some (but not all) happen to be about your product or website, that’s okay. However, you must disclose your affiliation in your answers.. In practice this means any answer that recommends your own blog must include something like "Disclosure: I am the author of the blog post that I am recommending here".2018年10月24日 21:19:21 +00:00Commented Oct 24, 2018 at 21:19
I don't need it everyday so I didn't reuse it recently but you can look at https://github.com/boundlessgeo/suite/tree/master/sdk/src/main/resources/client
It's the place where the code for OpenLayers 3 templates in OpenGeo Suite is. One of these templates is for using WFS-T. You have to look at ol3edit
and also ol3-common
. You will need to analyse JavaScript code as they (Boundless, the company behind) made a custom component for this purpose.
-
The link is now 404. Is it possible someone with the knowledge of where it pointed to could update it?Félix Gagnon-Grenier– Félix Gagnon-Grenier2018年10月24日 21:11:30 +00:00Commented Oct 24, 2018 at 21:11