[OpenLayers-Users] How to built save feature for WFS?
Xiaoyu Guan
guanxiaoyu at gmail.com
Mon Jun 21 15:43:52 EDT 2010
Dear All:
I try to built my own WFS server , I have Featureserver + mod_python
+postgis on my local pc.
If I use OpenLayers.Control.ModifyFeature(wfs) method, how can I catch the
modified feature and post it to FS?
I try to collect all features from wfs layer, and send it back to
featureserver. it doesn't work.
I have already try some example from OL examples . and I could not find a
lot of information about it in ol maillinglist.
It would be thanksful that somebody can point out where I should go.
Here is some code from my:
drawControls = {
point: new OpenLayers.Control.DrawFeature(vectors,
OpenLayers.Handler.Point),
line: new OpenLayers.Control.DrawFeature(vectors,
OpenLayers.Handler.Path),
polygon: new OpenLayers.Control.DrawFeature(vectors,
OpenLayers.Handler.Polygon),
editPolygon:new OpenLayers.Control.ModifyFeature(wfs, {
title: "Modify polygon"}))
};
var arr = [];
var j = 0;
for(var i =0; i<wfs.features.length;i++){
if(wfs.features[i].gml.featureType == "polygon"){
arr[j] = wfs2.features[i];
j++;
}
}
json = geojson.write(arr);
new OpenLayers.Ajax.Request(url,
{ method: 'post',
postBody: json,
requestHeaders: ['Accept', 'application/json'],
onSuccess: success,
onFailure: function(xhr) {
$('info').innerHTML = "Failed upload (status code
"+xhr.status+"). Check your URL."
}
}
);
all the best
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100621/7abc5c27/attachment.html
More information about the Users
mailing list