Thanks for your replies. I found some hints for the update by analysing the GML request. Seems the layer is incorrect in the request:
<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" version="1.0.0" service="WFS"> <wfs:Update typeName="features"> .... Indeed, "features" is not the layer address. With the correct typeName (G4WD:tasmania_water) it worked (I tried with the GeoServer request demo form). Here some snippets of my code: /* getting the layer */ var water = new OpenLayers.Layer.WFS( "Water", "/geoserver/wfs", {typename: 'G4WD:tasmania_water'}, { typename: 'tasmania_water', featureNS: 'http://www.mapmap.org/g4wd', extractAttributes: false } ); /* the modify control */ /* first some options */ var modifyOptions = { onModificationStart: function(feature) { OpenLayers.Console.log("start modifying", feature.id); }, onModification: function(feature) { OpenLayers.Console.log("modified", feature.id); }, onModificationEnd: function(feature) { OpenLayers.Console.log("end modifying", feature.id); /* the UPDATE state is modified here!!!! */ feature.state = OpenLayers.State.UPDATE; }, onDelete: function(feature) { OpenLayers.Console.log("delete", feature.id); } }; var modify = new OpenLayers.Control.ModifyFeature(water,modifyOptions); map.addControl(modify); I then use the commit method of the WFS layer. So, anything I missed in the use of OpenLayers API? Thanks! Arnaud -----Message d'origine----- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Pierre GIRAUD Envoyé : mercredi 16 janvier 2008 11:49 À : Yingqi Cc : [email protected] Objet : Re: [OpenLayers-Users] WFS-T delete/update Hi Arnaud, I didn't use the WFS-T functionnalities for a long time now. I hope I can throw an eye on it, but I don't think I will have time soon. However, don't hesitate to send snippets of code so that I can reproduce your test case. Regards, Pierre On Jan 16, 2008 9:06 AM, Yingqi <[EMAIL PROTECTED]> wrote: > > I think you should probably dig into OpenLayers\Format\GML.js to see if fid > is correctly retrieved when GML response from Geoserver was parsed when you > turned the layer. I guess fid attribute in your features are empty. > > > > Arno wrote: > > > > Hi all, > > > > I've been trying the WFS-T support for inserting polygons and it works > > greats (polygons added in the PostGIS database, using GeoServer 1.6). I > > tried also modifying features with the ModifyFeature Controls (based on > > the > > online example). Using the modifyOptions, I changed the state of the > > feature: > > > > feature.state = OpenLayers.State.UPDATE; > > > > and then tried to commit the WFS layer. But I received an error from the > > GeoServer (log traces something like "features is not available") and the > > transaction failed. Before asking something on the GeoServer list, is > > there > > anything I missed when trying to modify the feature with OpenLayers? > > > > For deleting, I used the SelectFeature control, overrode the onSelect > > method > > to mark the feature as deleted: > > > > feature.state = OpenLayers.State.DELETE; > > > > and when committing the WFS layer, OpenLayers displayed a message saying > > that the fid was missing. Same as the update question, is there anything I > > missed when trying to mark the feature? > > > > Thanks! > > > > Arnaud > > > > _______________________________________________ > > Users mailing list > > [email protected] > > http://openlayers.org/mailman/listinfo/users > > > > > > -- > View this message in context: http://www.nabble.com/WFS-T-delete-update-tp14843989p14873181.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > > > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users > _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
