[OpenLayers-Users] SaveStrategy does not work - WFSProtocol
with Vector Layer
bartvde at osgis.nl
bartvde at osgis.nl
Fri Mar 19 09:19:48 EDT 2010
I think you should ask this question on the Geoserver list.
The OpenLayers side of things looks okay to me.
Best regards,
Bart
>
> 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
> --
> View this message in context:
> http://n2.nabble.com/SaveStrategy-does-not-work-WFSProtocol-with-Vector-Layer-tp4762666p4762666.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
More information about the Users
mailing list