[OpenLayers-Users] WFS-T update error

Dorin Tcaci dtcaci at pentalog.fr
Mon Aug 15 03:00:09 EDT 2011


Hi List,

I'm using OpenLayers 2.10 in tandem with the last version of GeoServer 
2.1.1.
I have a WFS layer defined on the map.
When i'm trying to "insert" or "delete" a feature -all works fine,
but in case of updating- i'm getting the same type error, doesn't matter 
what Postgres/Postgis table i want to update
or the number/type of fields it has.
Looking at the GeoServer's log, i found that the error is described by 
these lines:
--------------------------------------------------------------------------------------------------
2011-08-01 09:09:09,582 DEBUG [geotools.jdbc] - Updating features with 
prepared statement: UPDATE "public"."HOTSPOT" SET "the_geom" = 
GeomFromWKB(?, -1),"information" = ?,"name" = ?  WHERE ("id" = ?)
2011-08-01 09:09:09,582 DEBUG [geotools.jdbc] - 1 = POINT 
(653316.2501440654 6861850.475276666)
2011-08-01 09:09:09,582 DEBUG [geotools.jdbc] - 2 = hotspot info
2011-08-01 09:09:09,582 DEBUG [geotools.jdbc] - 3 = hotspot
2011-08-01 09:09:09,582 ERROR [geoserver.wfs] - Transaction failed
org.geoserver.wfs.WFSTransactionException: Update error: 
org.postgresql.util.PSQLException: The column index is out of range: 5, 
number of columns: 4.

The WFS-T request:
---------------------------------------------------------------------------- 

             var featureType = 'HOTSPOT';
                           var featurePrefix = 'PP';
                           var srsName = 'EPSG:2154';
                           var url = "http://localhost:80/geoserver/wfs" ;

             var layer = new OpenLayers.Layer.Vector("hotspot", {
                                projection: new 
OpenLayers.Projection(srsName),
                                protocol: new OpenLayers.Protocol.WFS({
                                    version: "1.1.0",
                                    url: url,
                                    featureType: featureType,
                                    featureNS: 'http://www.pp.fr',
                                    srsName: srsName,
                                    geometryName: "the_geom",
                                    schema: url + 
'/DescribeFeatureType?version=1.0.0&TypeName=' +featurePrefix +':'+ 
featureType
                                   }),
                                    styleMap: style_Map,
                            });
The posted GML was the following:
-------------------------------------------------------------------------------------------------
<wfs:Transactionxmlns: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.pp.fr 
http://localhost:80/geoserver/wfs/DescribeFeatureType?version=1.0.0&TypeName=PP:HOTSPOT"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 

<wfs:UpdatetypeName="feature:HOTSPOT"xmlns:feature="http://www.pp.fr">
<wfs:Property>
<wfs:Name>the_geom</wfs:Name>
<wfs:Value>
<gml:Pointxmlns:gml="http://www.opengis.net/gml"srsName="EPSG:2154">
<gml:pos>653316.2501440654 6861850.475276666</gml:pos>
</gml:Point>
</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>id</wfs:Name>
<wfs:Value>9</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>information</wfs:Name>
<wfs:Value>hotspot info</wfs:Value>
</wfs:Property>
<wfs:Property>
<wfs:Name>name</wfs:Name>
<wfs:Value>hotspot</wfs:Value>
</wfs:Property>
<ogc:Filterxmlns:ogc="http://www.opengis.net/ogc">
<ogc:FeatureIdfid="HOTSPOT.9"></ogc:FeatureId>
</ogc:Filter>
</wfs:Update>
</wfs:Transaction>

After doing some tests, i noticed that the error is caused by sending 
"ID" (primary key) as a property.
If i modify the post and exclude the "id" attribute, the feature is 
saved successfully. So, what's wrong with my request?

Regards,
Dorin


More information about the Users mailing list