Hello Arnd, That worked perfectly, thank you. Similarly one has to put a feature.state=OpenLayers.State.DELETE; on a feature one wants to delete programatically.
Kind Regards, Toby On 10 November 2011 18:23, Arnd Wippermann <[email protected]> wrote: > It seems, you have to set the state of the feature. > > feature.state=OpenLayers.State.INSERT; > > > function addPoint() { > var features = []; > > var feature = new OpenLayers.Feature.Vector(new > OpenLayers.Geometry.Point(0,0)); > feature.state=OpenLayers.State.INSERT; > features.push(feature); > wfs.addFeatures(features); > wfs.redraw(); > } > addPoint(); > > Arnd > > -----Ursprüngliche Nachricht----- > Von: [email protected] > [mailto:[email protected]] Im Auftrag von Toby > Reinicke > Gesendet: Donnerstag, 10. November 2011 17:53 > An: Lucas Heezen - Covadis > Cc: [email protected] > Betreff: Re: [OpenLayers-Users] Save strategy with WFS not working > withprogramatically added features.. > > I'm afraid I don't think that's right. The point that I am having trouble > saving is the one that is created when you click 'add', I suggest you delete > all visible points and then click save. So that you start off with a blank > canvas. Then click add, a point will be created at a hard coded location. > Clicking save brings up the success message, however refreshing the page > loses that point. > > On 10 Nov 2011, at 16:18, Lucas Heezen - Covadis <[email protected]> wrote: > >> Hello Tobias, >> >> Tried your page in IE9 and it saves the points. Maybe there is a Chrome > problem? >> If you refresh the page you will see the points. >> >> >> Met vriendelijke groet, >> Lucas Heezen >> >> Covadis b.v. >> t: 026 3616600 >> >> Geograaf 12 >> f: 026 3612317 >> >> 6921 EW Duiven >> e: [email protected] >> >> >> >> -----Oorspronkelijk bericht----- >> Van: [email protected] >> [mailto:[email protected]] Namens Tobias >> Reinicke >> Verzonden: donderdag 10 november 2011 17:09 >> Aan: [email protected] >> Onderwerp: [OpenLayers-Users] Save strategy with WFS not working with > programatically added features.. >> >> Hi, >> >> Basically what the subject says. I have created a page based very heavily > on the wfs example, and it all works fine when the draw control is used. >> >> However when I add a point to the layer programatically the Save strategy > doesn't work. >> >> http://defra.eodata.co.uk/toby/demos/wgs84/wfstest.html >> >> example page there.. >> >> top buttons add points (yes, wrong icon I know), edits and deletes. >> >> add point button adds a point to the 'wfs' layer, but then on save does > not get written back to the db. I have looked at the call in chrome dev > tools and none of the <WFS:insert> statements are coming through. >> >> Any ideas, >> >> Thanks, >> >> Toby >> _______________________________________________ >> Users mailing list >> [email protected] >> http://lists.osgeo.org/mailman/listinfo/openlayers-users > _______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users > > _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
