[OpenLayers-Users] wfs-t
Christopher Schmidt
crschmidt at metacarta.com
Wed Apr 29 18:01:00 EDT 2009
On Thu, Apr 30, 2009 at 09:36:37AM +1200, chris Wild wrote:
> 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?
Yes. The "new vector layer" has a strategy and protocol which tells it
"Go download data from this remote server" -- instead of having a
different layer subclass, you have the ability to mix and match how, and
when, to download and upload data. Just because it says "Layer.Vector"
does not mean that the data is only added manually anymore. (This ain't
your daddy's <s>Oldsmobile</s> OpenLayers.)
-- Chris
> 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
> >
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list