[OpenLayers-Users] Layer.addFeatures displays Point but can't get saved, why?

Simon Appelt flansch at gmx.de
Fri Feb 18 13:42:48 EST 2011


Dear List,

i've a problem with my wfs point Layer which cannot be saved, because 
the POST-Event empty . First of all here ist what i've done so far:

1. Created a saveStrategy:
     var savePoint = new OpenLayers.Strategy.Save();

2. Created my wfs point layer:
     var  wfs_punkte = new OpenLayers.Layer.Vector("test",{styleMap: 
layerStyle,
           strategies: [ new OpenLayers.Strategy.Fixed(),savePoint],
           protocol: new OpenLayers.Protocol.WFS({
             version: "1.1.0",
             srsName: "EPSG:900913",
             url: "http://localhost/geoserver/wfs",
             featureNS :  "http://www.maptags.de",
             featurePrefix: "ma",
             featureType: "ma_punkte",
             geometryName: "the_geom",
             schema: 
"http://localhost/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=ma:ma_punkte"
         })
     });

3. Created a polygon draw function:
   var drawControl = new OpenLayers.Control.DrawFeature(wfs_flaechen, 
OpenLayers.Handler.Polygon,
                       {
                         handlerOptions: {multi: true},
                          featureAdded: Centroid
                       });
     mapk.addControl(drawControl);

4. The Centroid function which gets called:
     function Centroid(feature){
         var cent = feature.geometry.getCentroid();
         var point = new OpenLayers.Geometry.Point(cent.x, cent.y);
         wfs_punkte.addFeatures([new OpenLayers.Feature.Vector(point)]);
     savePoint.save();
     }

The Point is displayed correct at my map and FireBug reports me a 
POST-Event, but its empty no Point geometry added to the XML:
<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" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></wfs:transaction>

Any Ideas? Thanks a lot!
Simon




More information about the Users mailing list