I keep getting an insert error from geoserver when trying to save a point, poly etc etc to my postgis table. any ideas, my code is below

    var Projection = new OpenLayers.Projection("EPSG:4326"); 

    var map = new OpenLayers.Map("Map", {
        //projection: new OpenLayers.Projection("EPSG:900913"),

    //add google map
    var GoogleMap = new OpenLayers.Layer.Google(
            maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
            numZoomLevels: 21  

    var NYC = new OpenLayers.Layer.WMS(
      "nyc_buildings - Tiled", "http://soiisdev:8080/geoserver/wms",
            layers: 'cite:nyc_buildings',
            styles: '',
            format: "image/png",
            tiled: 'true',
            transparent: true,
            buffer: 0,
            displayOutsideMaxExtent: true

   var saveStrategy = new OpenLayers.Strategy.Save({auto:true})

    var vectors = new OpenLayers.Layer.Vector("Vectors", {
        strategies: [
            new OpenLayers.Strategy.BBOX(), 
        protocol: new OpenLayers.Protocol.WFS({
            version: "1.1.0", 
            url:  "http://soiisdev:8080/geoserver/wfs",
            featureNS : "http://www.opengeospatial.net/cite", 
            featureType: "nyc_vectors",
            srsName: "EPSG:4326"

    map.addLayers([GoogleMap, NYC, vectors]); 

    var LonLat = new OpenLayers.LonLat(-73.988113, 40.750898);
    LonLat.transform(Projection, map.getProjectionObject());  
    map.setCenter(LonLat, 15); 

ive checked the header in fiddler and below is the xml sent to geoserver

<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation="http://www.opengis.net/wfs  http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
 <feature:nyc_vectors xmlns:feature="http://www.opengeospatial.net/cite">
     <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
       <gml:pos>-73.986374928559 40.742379645006</gml:pos>

  • 1
    you should post the postgreSQL error message
    – simo
    Apr 27 '11 at 12:43
  • I'd agree; the code looks good, so post the error, and possibly any logs.
    – Hairy
    Apr 27 '11 at 13:24
  • Recent one of 2.1 RC release has issue with WFS-T and Postgis. try with latest RC5
    – Senthil
    Apr 27 '11 at 17:47
  • Probably just a copy and paste mistake, but the XML is incomplete: The closing </wfs:Transaction> and </wfs:insert> are missing. Mmmh, also the xmlns:xsi attribute is missing a closing quote!
    – hfs
    Oct 21 '12 at 20:18

You should also post the version of PostGIS and PostgreSQL you are using.

To determine that use:

SELECT postgis_full_version(); SELECT version();

Note in PostGIS 2.0 we dropped a lot of deprecated functions. This has caused some people running GeoServer some problems. If you are running GeoServer latest RC and PostGIS 2.0 and you are still having problems. Install the legacy.sql file packaged with PostGIS 2.0.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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