[OpenLayers-Users] Save strategy with WFS not working withprogramatically added features..

Tobias Reinicke ramotswa at gmail.com
Fri Nov 11 03:43:48 EST 2011


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 <arnd.wippermann at web.de> 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: openlayers-users-bounces at lists.osgeo.org
> [mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Toby
> Reinicke
> Gesendet: Donnerstag, 10. November 2011 17:53
> An: Lucas Heezen - Covadis
> Cc: users at openlayers.org
> 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 <heezen at covadis.nl> 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: heezen at covadis.nl
>>
>>
>>
>> -----Oorspronkelijk bericht-----
>> Van: openlayers-users-bounces at lists.osgeo.org
>> [mailto:openlayers-users-bounces at lists.osgeo.org] Namens Tobias
>> Reinicke
>> Verzonden: donderdag 10 november 2011 17:09
>> Aan: users at openlayers.org
>> 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
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>


More information about the Users mailing list