I tried following the tutorials: http://www.gistutor.com/openlayers/22-advanced-openlayers-tutorials/47-openlayers-wfs-t-using-a-geoserver-hosted-postgis-layer.html and: http://apps.who.int/tools/geoserver/www/wfs-t.html

With the following results:

  • the delete-function works, ergo I am able to alter my data in the postgres file.
  • when inserting or editing a polygon I always get the answer:
<wfs:FAILED></wfs:FAILED> </wfs:Status> <wfs:Message>Error performing insert: Error inserting features</wfs:Message>


<ogc:FeatureId fid="none"></ogc:FeatureId>
<wfs:Message>Update error: Error occured updating features</wfs:Message>

I made a simple file, using only one kind of projection (EPSG:32647)- still, same problem. Where do I go wrong?!

My Postgres Data-Table:

  • gid - Integer, not null
  • fid - double precision
  • geom - geometry(MultiPolygon,32647)

Here is my code:

function init(){

var saveStrategy = new OpenLayers.Strategy.Save();

//empty map, bounds are test-layer bounds (EPSG:32647)  
map = new OpenLayers.Map({
    div: "map",
    allOverlays: true,
    maxExtent: new OpenLayers.Bounds(

//WFS-Layer Test= editable data
var test = new OpenLayers.Layer.Vector("Editable Features", {
    strategies: [new OpenLayers.Strategy.Fixed(), saveStrategy],    
    protocol: new OpenLayers.Protocol.WFS({
    url: "http://..../wfs",
    featurePrefix: 'testkf',
    featureNS: "http://.../testkf",
    featureType: "test",
    geometryName: "geom",


    var panel = new OpenLayers.Control.Panel(
    {'displayClass': 'customEditingToolbar'}

    var navigate = new OpenLayers.Control.Navigation({
    title: "Pan Map"

    var draw = new OpenLayers.Control.DrawFeature(
    test, OpenLayers.Handler.Polygon,
    title: "Draw Feature",
    displayClass: "olControlDrawFeaturePolygon",
    multi: true

    var edit = new OpenLayers.Control.ModifyFeature(test, {
    title: "Modify Feature",
    displayClass: "olControlModifyFeature"

    var save = new OpenLayers.Control.Button({
    title: "Save Changes",
    trigger: function() {
    if(edit.feature) {
    displayClass: "olControlSaveFeatures"

panel.addControls([save, edit, draw, navigate]);
panel.defaultControl = navigate;
map.addControl(new OpenLayers.Control.LayerSwitcher());

Thanks for your help!!

Edit: I use Geoserver 2.1.4 and PostGIS 2.0 for PostgreSQL 9.1

3 Answers 3


You don't say what versions of the software you are using but if it is a recent PostGIS (1.9+) and an older GeoServer (2.1.x -) then you will need to run the legacy.sql script to add geomFromText() (and other functions) back into PostGIS. See http://postgis.refractions.net/docs/PostGIS_FAQ.html#legacy_faq for more details.

  • Sorry, forgot to mention that:I use Geoserver 2.1.4 and PostGIS 2.0 for PostgreSQL 9.1.
    – Cat
    Sep 24, 2012 at 14:14
  • then you'll need this step
    – Ian Turton
    Sep 24, 2012 at 14:24
  • thank you so very much - with the legacy.sql functions it finally works!
    – Cat
    Sep 25, 2012 at 13:59

Most likely the insert statement is trying to insert something and there is some kind of conflict with the geometry field (e.g. dimension constraint of the geometry, coordinates, something else).

Enable debugging in the postgresql server and you will see the insert statement geoserver is creating. You can copy and paste that statement to psql, and the problem will (hopefully) be obvious from there.


try define projection for map, and srs in the wfs protocol. if you are using firebug then copy an paste the request in the geoserver demo. i think the problem is with postgis. i had to switch back to postgis1.5 and postgres9.0 to make it work.

  • I did define the projection for the map in an earlier version, but that alone did not do the trick. With the legacy.sql functions AND the projection-statements I finally had SUCCESS ;). So thanks!!
    – Cat
    Sep 25, 2012 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.