[OpenLayers-Users] wfs update
Gabriel Nolasco
nolasco_gabriel at yahoo.com.br
Thu Jul 16 17:47:31 EDT 2009
Hi Eric,
Thanks for your quick response.
I know the vector layer protocol class and its advantages but it crashes in IE and I must ensure my application’s cross-browser compatibility.
Anyway this should be very straightforward and there must be some detail that I’m missing...
> On Thursday, July 16, 2009, Gabriel Nolasco
> <nolasco_gabriel at yahoo.com.br>
> wrote:
> >
> > Hi!
> >
> > I?m trying to update feature?s attributes on a WFS
> layer without successes.
> >
> > This is my layer instantiation:
> >
> > var myWFSLayer = new OpenLayers.Layer.WFS(
> > ? ? ? ?"myWFSLayerName",
> > ? ? ? ?"myWFSLayerServiceURL",
> > ? ? ? ?{typename: 'topp:myWFSLayerTypename'},
> > ? ? ? ?{
> > ? ? ? ? ? ? ? ?typename: "myWFSLayerTypename",
> > ? ? ? ? ? ? ? ?featureNS: "http://www.openplans.org/topp",
> > ? ? ? ? ? ? ? ?extractAttributes: true
> > ? ? ? ?}
> > );
> >
> >
> > My feature attributes:
> >
> > var myAttributes = {
> > ? ? ? ?"myField1": "myAttribute1",
> > ? ? ? ?"myField2": "myAttribute2"
> > }
> >
> >
> > If I commit a new feature setting the state to
> ?insert? the transaction succeeds and the feature is stored
> with its attributes:
> >
> > myNewFeature.state = OpenLayers.State.INSERT;
> > myNewFeature.attributes = myAttributes;
> > myWFSLayer.commit();
> >
> >
> > However, if I set a previously existent feature state
> to "update" there are no changes in the database after the
> commit and the feature keeps its old attributes:
> >
> > myOldFeature.state = OpenLayers.State.UPDATE;
> > myOldFeature.attributes = myAttributes;
> > myWFSLayer.commit();
> >
> >
> > I?m using postgreSQL 8.3 + GeoServer 1.7.5 +
> OpenLayers 2.8
> > Anyone has an idea about what I?m missing?
>
>
> Hi. I haven't looked at your code into detail but if you
> use
> OpenLayers 2.8 it is highly recommended that you use
> OpenLayers.Layer.Vector with OpenLayers.Protocol.WFS
> instead of
> OpenLayers.Layer.WFS. Look at the wfs example.
>
>
> >
> > Thanks in advance,
> > Gabriel Nolasco
> >
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
More information about the Users
mailing list