Wfs Insert problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Wfs Insert problem

MJ82
Dear all,

I am having problem with inserting new features to my postgis database using geoserver +openlayers.

The problem is that I can easily insert new features to a layer that already contain some features, but when the layer is empty it can't be inserted. Even if I delete all the features of a layer I can't insert new ones. I don't get any errors to find out the problem.

My code:

   saveStrategy.events.register('success', null, saveSuccess);
    saveStrategy.events.register('fail', null, saveFail);
    var wfsLayer = new OpenLayers.Layer.Vector("Development plan ",
    {
        //styleMap: styles,
  strategies : [new OpenLayers.Strategy.Fixed(), saveStrategy], projection : new OpenLayers.Projection("EPSG:900913"), protocol : new OpenLayers.Protocol.WFS( {

            url : "http://XX/wfs", version : "1.1.0", srsName : "EPSG:900913", featureType : "floodway", featureNS : "http://postgis.org", visibility : true

        })
    });


This is geoserver log:

2011-09-20 20:55:14,053 INFO [geoserver.wfs] -
Request: getServiceInfo
2011-09-20 20:55:14,178 INFO [geoserver.wfs] -
Request: transaction
        handle = null
        service = WFS
        version = 1.1.0
        baseUrl = http://XX:8082/geoserver/
        providedVersion = null
        extendedProperties = {}
        lockId = null
        group = [wfs:insert=net.opengis.wfs.impl.InsertElementTypeImpl@64f5bdb4 (feature: [SimpleFeatureImpl:newtest=[SimpleFeatureImpl.Attribute: the_geom<the_geom id=fid--77bab207_132895b7e36_-7fb7>=null, SimpleFeatureImpl.Attribute: shape_fid<shape_fid id=fid--77bab207_132895b7e36_-7fb7>=null]], handle: null, idgen: <unset>, inputFormat: <unset>, srsName: null)]
        insert = [net.opengis.wfs.impl.InsertElementTypeImpl@64f5bdb4 (feature: [SimpleFeatureImpl:newtest=[SimpleFeatureImpl.Attribute: the_geom<the_geom id=fid--77bab207_132895b7e36_-7fb7>=null, SimpleFeatureImpl.Attribute: shape_fid<shape_fid id=fid--77bab207_132895b7e36_-7fb7>=null]], handle: null, idgen: <unset>, inputFormat: <unset>, srsName: null)]
        update = []
        delete = []
        native = []
        releaseAction = ALL
Reply | Threaded
Open this post in threaded view
|

Re: Wfs Insert problem

MJ82
Dear friends,

Since this problem is solved, I want to mention here the changes I made. It is surprisingly simple.

This is the new one:

    var wfsLayer = new OpenLayers.Layer.Vector("Development plan ",
    {
  strategies : [new OpenLayers.Strategy.BBOX(), saveStrategy],
  protocol : new OpenLayers.Protocol.WFS( {
version : "1.1.0",
            url : "http://X/wfs",
            featureType : "hello",
            featureNS : "http://postgis.org", visibility : true,
            geometryName: "the_geom"

        })
    });

Basically the only change is:
geometryName: "the_geom",

Since my data is EPSG:26911, this should be added so that you can see the WFS layer
srsName : "EPSG:900913",

otherwise the inserted feature cannot be displayed.

Regards,
M