[OpenLayers-Users] wfs-t

chris Wild chrismwild at gmail.com
Wed Apr 29 17:36:37 EDT 2009


Thanks for speedy reply, much appreciated.
That example works with a new vector layer, with trunck/2.8-rc1 will I be
able to edit/add existing features in a geodatabase?

On Thu, Apr 30, 2009 at 9:28 AM, Christopher Schmidt <
crschmidt at metacarta.com> wrote:

> On Thu, Apr 30, 2009 at 08:46:16AM +1200, chris Wild wrote:
> > Hi all,
> > Can someone please tell me whats missing from my code to get WFS-t to
> commit
> > changes.
> > The demo works fine and my example works fine up to saving changes to
> file
> > when an extra line is added.The data is added from postgreSQl database
> with
> > PostGIS.
>
>
> The Layer.WFS pobably will not work to save changes to a server. Look at
> http://openlayers.org/dev/examples/wfs-protocol-transactions.html
> instead. (Needs trunk/2.8-rc1)
>  >             var roads = new OpenLayers.Layer.WFS(
> >                 "Track",
> >                 "/geoserver/wfs",
> >                 {typename: 'topp:ttlines'},
> >                 {
> >                     typename: 'topp:ttlines',
> >                     featureNS: 'http://www.openplans.org/topp',
> >                     extractAttributes: false
> >                 }
> >             );
> >             roads.style = OpenLayers.Util.applyDefaults({strokeColor:
> > "#ff0000"},
> >                     OpenLayers.Feature.Vector.style["default"]);
> >
> >             map.addLayers([tiled, untiled, roads]);
> >
> >             var panel = new OpenLayers.Control.Panel(
> >                 {displayClass: 'olControlEditingToolbar'}
> >             );
> >
> >             var drawLine = new OpenLayers.Control.DrawFeature(
> >                 roads, OpenLayers.Handler.Path,
> >                 {displayClass: 'olControlDrawFeaturePath'}
> >             );
> >                 drawLine.featureAdded = function(feature) {
> >                 feature.layer.eraseFeatures([feature]);
> >                 // cast to multilinestring
> >                 feature.geometry = new
> OpenLayers.Geometry.MultiLineString(
> >                     feature.geometry
> >                 );
> >                 feature.style.strokeColor = "#ff0000";
> >                 feature.state = OpenLayers.State.INSERT;
> >                 feature.layer.drawFeature(feature);
> >             }
> >
> >             panel.addControls(
> >                 [new OpenLayers.Control.Navigation(), drawLine]
> >             );
> >             map.addControl(panel);
> >             map.addControl(new OpenLayers.Control.LayerSwitcher());
> >             map.zoomToExtent(
> >                 new OpenLayers.Bounds(2629421.7940751617,
> 6192776.755018141,
> >                     2633541.55790017, 6195366.924973875)
> >             );
> >         }
> >     </script>
> >   </head>
> >   <body onload="init()">
> >     <h3>OpenLayers WFS-T demo: Tasmania cities and roads</h3>
> >     <a href="#" onclick="map.layers[2].commit();return false">Save
> Roads</a>
> >     <div id="map"></div>
> >   </body>
> > </html>
> >
> > Many Thanks
> > Chris
>
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
>
>
> --
> Christopher Schmidt
> MetaCarta
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090430/3d0cf926/attachment.html


More information about the Users mailing list