<div>Hi Chris,</div>
<div>Having trouble figuring out how to adapt the example from a new vector to existing layer.</div>
<div> </div>
<div>tried this </div><span lang="EN-NZ">
<p>wfs = new OpenLayers.Layer.Vector("Editable Features", {</p>
<p>strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],</p>
<p>projection: new OpenLayers.Projection("EPSG:27200"),</p>
<p>protocol: new OpenLayers.Protocol.WFS({</p>
<p>version: "1.1.0",</p>
<p>srsName: "EPSG:27200",</p>
<p>url: "<a href="http://localhost:8080/geoserver/wfs">http://localhost:8080/geoserver/wfs</a>",</p>
<p>typename: 'topp:ttlines',</p>
<p>featureNS : '<a href="http://www.openplans.org/topp">http://www.openplans.org/topp</a>',</p>
<p>featureType: "restricted",</p>
<p>geometryName: "the_geom",</p>
<p>schema: "<a href="http://demo.opengeo.org/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=og:restricted">http://demo.opengeo.org/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=og:restricted</a>"</p>
<p>})</p>
<p>}); </p>
<div></div></span>But not correct, any suggestions or pointer to examples using existing layer.
<div> </div>
<div>Thanks</div>
<div>Chris<br><br></div>
<div class="gmail_quote">On Thu, Apr 30, 2009 at 10:01 AM, Christopher Schmidt <span dir="ltr"><<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="im">On Thu, Apr 30, 2009 at 09:36:37AM +1200, chris Wild wrote:<br>> Thanks for speedy reply, much appreciated.<br>> That example works with a new vector layer, with trunck/2.8-rc1 will I be<br>> able to edit/add existing features in a geodatabase?<br>
<br></div>Yes. The "new vector layer" has a strategy and protocol which tells it<br>"Go download data from this remote server" -- instead of having a<br>different layer subclass, you have the ability to mix and match how, and<br>
when, to download and upload data. Just because it says "Layer.Vector"<br>does not mean that the data is only added manually anymore. (This ain't<br>your daddy's <s>Oldsmobile</s> OpenLayers.)<br>
<br>-- Chris<br>
<div>
<div></div>
<div class="h5"><br><br><br>> On Thu, Apr 30, 2009 at 9:28 AM, Christopher Schmidt <<br>> <a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>> wrote:<br>><br>> > On Thu, Apr 30, 2009 at 08:46:16AM +1200, chris Wild wrote:<br>
> > > Hi all,<br>> > > Can someone please tell me whats missing from my code to get WFS-t to<br>> > commit<br>> > > changes.<br>> > > The demo works fine and my example works fine up to saving changes to<br>
> > file<br>> > > when an extra line is added.The data is added from postgreSQl database<br>> > with<br>> > > PostGIS.<br>> ><br>> ><br>> > The Layer.WFS pobably will not work to save changes to a server. Look at<br>
> > <a href="http://openlayers.org/dev/examples/wfs-protocol-transactions.html" target="_blank">http://openlayers.org/dev/examples/wfs-protocol-transactions.html</a><br>> > instead. (Needs trunk/2.8-rc1)<br>> > > var roads = new OpenLayers.Layer.WFS(<br>
> > > "Track",<br>> > > "/geoserver/wfs",<br>> > > {typename: 'topp:ttlines'},<br>> > > {<br>
> > > typename: 'topp:ttlines',<br>> > > featureNS: '<a href="http://www.openplans.org/topp" target="_blank">http://www.openplans.org/topp</a>',<br>
> > > extractAttributes: false<br>> > > }<br>> > > );<br>> > > roads.style = OpenLayers.Util.applyDefaults({strokeColor:<br>> > > "#ff0000"},<br>
> > > OpenLayers.Feature.Vector.style["default"]);<br>> > ><br>> > > map.addLayers([tiled, untiled, roads]);<br>> > ><br>> > > var panel = new OpenLayers.Control.Panel(<br>
> > > {displayClass: 'olControlEditingToolbar'}<br>> > > );<br>> > ><br>> > > var drawLine = new OpenLayers.Control.DrawFeature(<br>> > > roads, OpenLayers.Handler.Path,<br>
> > > {displayClass: 'olControlDrawFeaturePath'}<br>> > > );<br>> > > drawLine.featureAdded = function(feature) {<br>> > > feature.layer.eraseFeatures([feature]);<br>
> > > // cast to multilinestring<br>> > > feature.geometry = new<br>> > OpenLayers.Geometry.MultiLineString(<br>> > > feature.geometry<br>
> > > );<br>> > > feature.style.strokeColor = "#ff0000";<br>> > > feature.state = OpenLayers.State.INSERT;<br>> > > feature.layer.drawFeature(feature);<br>
> > > }<br>> > ><br>> > > panel.addControls(<br>> > > [new OpenLayers.Control.Navigation(), drawLine]<br>> > > );<br>> > > map.addControl(panel);<br>
> > > map.addControl(new OpenLayers.Control.LayerSwitcher());<br>> > > map.zoomToExtent(<br>> > > new OpenLayers.Bounds(2629421.7940751617,<br>> > 6192776.755018141,<br>
> > > 2633541.55790017, 6195366.924973875)<br>> > > );<br>> > > }<br>> > > </script><br>> > > </head><br>> > > <body onload="init()"><br>
> > > <h3>OpenLayers WFS-T demo: Tasmania cities and roads</h3><br>> > > <a href="#" onclick="map.layers[2].commit();return false">Save<br>> > Roads</a><br>
> > > <div id="map"></div><br>> > > </body><br>> > > </html><br>> > ><br>> > > Many Thanks<br>> > > Chris<br>> ><br>> > > _______________________________________________<br>
> > > Users mailing list<br>> > > <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>> > > <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
> ><br>> ><br>> > --<br>> > Christopher Schmidt<br>> > MetaCarta<br>> ><br><br></div></div><font color="#888888">--<br>Christopher Schmidt<br>MetaCarta<br></font></blockquote></div><br>