[OpenLayers-Users] SaveStrategy does not work - WFSProtocol
with Vector Layer
moataz Elmasry
zaza1851983ml at googlemail.com
Fri Mar 19 09:17:15 EDT 2010
I might be wrong, but maybe your problem might be related to proxy
issues. are you using proxy.cgi?
Maybe you want to see check threads out:
http://n2.nabble.com/Problem-with-WFS-proxy-cgi-td4662347.html
http://old.nabble.com/proxy.cgi-for-WFS-td20239114.html
open layer has its own python proxy
http://trac.openlayers.org/browser/trunk/openlayers/examples/proxy.cgi
The big problem is that proxy issues fails silently. So this might be
the case with with you
Best of luck
paweluz wrote:
> Hi!
>
> I am using Postgis, Geoserver and Openlayers 2.8. I create my simple
> application based on this example
> http://dev.openlayers.org/releases/OpenLayers-2.8/examples/wfs-protocol-transactions.html.
> I can see the vector on map, I can get the object attributes from the
> feature I clicked on, but I have problem with adding new data to the
> database.
> When I click the add button the new row is added to the table in my database
> but the row is empty without any data...
>
> My code:
>
> var saveStrategy = new OpenLayers.Strategy.Save();
>
> var wfsproba = new OpenLayers.Layer.Vector("Vector Layer", {
> strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
> projection: new OpenLayers.Projection("EPSG:4326"),
> styleMap: wfs_style,
> protocol: new OpenLayers.Protocol.WFS({
> version: "1.1.0",
> srsName: "EPSG:4326",
> url: "http://localhost:8080/geoserver/wfs",
> featureNS : "http://www.openplans.org/topp",
> featureType: "probabaza",
> geometryName: "the_geom",
> schema:
> "http://localhost:8080/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=topp:probabaza",
> })
> });
> drawControls = {
> line: new OpenLayers.Control.DrawFeature(
> wfsproba, OpenLayers.Handler.Path)};
> for(var key in drawControls) {
> map.addControl(drawControls[key]);}
> // On button click
> function addobject() {
> saveStrategy.save();
> }
>
> This think is really weird because in firebug I got information that data
> was added to the database.
> Here is info:
>
> Source:
> <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
> version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs
> http://schemas.opengis.net/wfs/1.1.0/wfs.xsd http://www.openplans.org/topp
> http://localhost:8080/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=topp:probabaza"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <wfs:Insert>
> <feature:probabaza xmlns:feature="http://www.openplans.org/topp">
> <feature:the_geom>
> <gml:LineString xmlns:gml="http://www.opengis.net/gml"
> srsName="EPSG:4326"><gml:posList>15.542907714844 51.947650889872
> 15.542907714844 51.942995059059</gml:posList></gml:LineString>
> </feature:the_geom>
> </feature:probabaza>
> </wfs:Insert>
> </wfs:Transaction>
>
> Response
> <?xml version="1.0" encoding="UTF-8"?>
> <wfs:TransactionResponse version="1.1.0"
> xsi:schemaLocation="http://www.opengis.net/wfs
> http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd"
> xmlns:ogc="http://www.opengis.net/ogc" xmlns:tiger="http://www.census.gov"
> xmlns:wfs="http://www.opengis.net/wfs"
> xmlns:topp="http://www.openplans.org/topp"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:sf="http://www.openplans.org/spearfish"
> xmlns:ows="http://www.opengis.net/ows"
> xmlns:gml="http://www.opengis.net/gml"
> xmlns:xlink="http://www.w3.org/1999/xlink"><wfs:TransactionSummary>
> <wfs:totalInserted>1</wfs:totalInserted>
> <wfs:totalUpdated>0</wfs:totalUpdated>
> <wfs:totalDeleted>0</wfs:totalDeleted>
> </wfs:TransactionSummary>
> <wfs:TransactionResults/>
> <wfs:InsertResults>
> <wfs:Feature>
> <ogc:FeatureId fid="probabaza.162"/>
> </wfs:Feature>
> </wfs:InsertResults>
> </wfs:TransactionResponse>
>
> As you can see I got info that there was one object insertet, but in my
> database all I got in new empty rows... When I add 5 new geometry and got 5
> new empty rows in my database... In firebug I got info that I had inserted 5
> new object.
> Maybe I should "tell" savestategy in what column the geometry should be
> inserted.... I have no idea... My geometry column is named 'the_geom'.
>
> Why is that? Cane anybody please help me
>
> Regards,
> Poul
>
More information about the Users
mailing list