Hey- chris Wild wrote: > Hi Chris, > Having trouble figuring out how to adapt the example from a new vector > to existing layer. >
Is your web page being served up on port 8008 (from localhost and via http)? If not, you'll need to read up on the same origin policy. Three alternatives (if this is your issue): 1) Get your WFS on port 80 http://geoserver.org/display/GEOSDOC/How+to+proxy+Jetty+through+Apache+on+port+80 2) Set OpenLayers.ProxyHost to something that can proxy for you http://faq.openlayers.org/proxyhost/ 3) Have your page served up on port 8080 (you can dump stuff in the www dir in your geoserver config dir - not recommended for production). If this is not your issue, disregard these suggestions. Tim > tried this > > wfs = new OpenLayers.Layer.Vector("Editable Features", { > > strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy], > > projection: new OpenLayers.Projection("EPSG:27200"), > > protocol: new OpenLayers.Protocol.WFS({ > > version: "1.1.0", > > srsName: "EPSG:27200", > > url: "http://localhost:8080/geoserver/wfs", > > typename: 'topp:ttlines', > > featureNS : 'http://www.openplans.org/topp', > > featureType: "restricted", > > geometryName: "the_geom", > > schema: > "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>" > > }) > > }); > > But not correct, any suggestions or pointer to examples using existing > layer. > > Thanks > Chris > > On Thu, Apr 30, 2009 at 10:01 AM, Christopher Schmidt > <[email protected] <mailto:[email protected]>> wrote: > > 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 < > > [email protected] <mailto:[email protected]>> 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 > > > > [email protected] <mailto:[email protected]> > > > > http://openlayers.org/mailman/listinfo/users > > > > > > > > > -- > > > Christopher Schmidt > > > MetaCarta > > > > > -- > Christopher Schmidt > MetaCarta > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users -- Tim Schaub OpenGeo - http://opengeo.org Expert service straight from the developers. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
