Problem saving added point to GeoServer WFS-T via OpenLayers?

المشرف العام

Administrator
طاقم الإدارة
I want to add a point and then with WFS-T, save this to db.

I work with Openlayers and GeoServer.

saveStrategy = new OpenLayers.Strategy.Save(); wfs = new OpenLayers.Layer.Vector( "WFS Vectore", { strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy], projection: new OpenLayers.Projection("EPSG:4326"), protocol: new OpenLayers.Protocol.WFS({ version: "1.1.0", srsName: "EPSG:4326", url: "http://localhost:8080/geoserver/iran/wms?service=WFS", featureType: "population_utf-8", featureNS: "http://iran.kadaster.org", geometryName: "geom" }) }); I add point with two methods:

1.

wfs.addFeatures([new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point( (Math.floor(Math.random() * 360) - 180), (Math.floor(Math.random() * 180) - 90) ) )]); saveStrategy.save(); 2.

var drawFeatureController = new OpenLayers.Control.DrawFeature(wfs, OpenLayers.Handler.Point); And then add a point with the mouse:

saveStrategy.save(); The second method works but the first method doesn't.

I need the first method.

How can I do this?

update:




أكثر...
 
أعلى