Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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"),
        displayProjection:Projection,
        controls:[] 
       }
    );

    //add google map
    var GoogleMap = new OpenLayers.Layer.Google(
        "GoogleSatellite",{
            type:G_SATELLITE_MAP,
            isBaseLayer:true,
            sphericalMercator:true,
            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,
            Projection:Projection 
        },
        {
            buffer: 0,
            displayOutsideMaxExtent: true
        }               
   ); 

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

    var vectors = new OpenLayers.Layer.Vector("Vectors", {
        strategies: [
            new OpenLayers.Strategy.BBOX(), 
            saveStrategy
        ],
        Projection:Projection, 
        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]); 
    //map.zoomToMaxExtent();

    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">
<wfs:Insert>
 <feature:nyc_vectors xmlns:feature="http://www.opengeospatial.net/cite">
   <feature:the_geom>
     <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
       <gml:pos>-73.986374928559 40.742379645006</gml:pos>
     </gml:Point>
   </feature:the_geom>
 </feature:nyc_vectors>

share|improve this question
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
add comment

1 Answer

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.

http://www.postgis.org/documentation/manual-svn/PostGIS_FAQ.html#legacy_faq

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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