Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my web map application, I have added the editable wfs vector layer for feature editing. But in save strategy method, Insert and Update Geometry is working fine.But Update Attributes is not saved in transaction. Did I miss anything to include while adding editable layer? Please suggest me to fix this problem.

var saveStrategy;
function init(){ 
format = 'image/png';

bounds = new OpenLayers.Bounds(
            -288161.9289062237, -435.65815425360597,
            949406.755566389, 1300000
var options = {
controls: [],
maxExtent: bounds,
maxResolution: 5079.826789665053,
projection: "EPSG:404000",
units: 'm'

 osMap = new OpenLayers.Map('map', options);

//Setup Base layer
tiled = new OpenLayers.Layer.WMS(
            "Oxford_Map", "http://xxx.xx.x.xx:8080/geoserver/cite/wms",
                LAYERS: 'Oxford_Map',
                STYLES: '',
                format: format,
                tiled: true,
                tilesOrigin: osMap.maxExtent.left + ',' + osMap.maxExtent.bottom
                buffer: 0,
                displayOutsideMaxExtent: true,
                isBaseLayer: true,
                yx: { 'EPSG:404000': false }

untiled = new OpenLayers.Layer.WMS(
            "Oxford_Map", "http://xxx.xx.x.xx:8080/geoserver/cite/wms",
                LAYERS: 'Oxford_Map',
                STYLES: '',
                format: format
                singleTile: true,
                ratio: 1,
                isBaseLayer: true,
                yx: { 'EPSG:404000': false }

 osMap.addLayers([untiled, tiled]);

 //set up a save strategy
saveStrategy = new OpenLayers.Strategy.Save();"success", '', ChangesSuccess);"failure", '', ChangesFailed);

wfs = new OpenLayers.Layer.Vector("ODC_Private_Graphics_Data", {
    strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],     
    projection: 'EPSG:27700',
    protocol: new OpenLayers.Protocol.WFS({
        version: '1.1.0',
        url: '',
        featurePrefix: 'cite',
        featureNS: '',                        
        featureType: 'ODC_Private_Graphics_Data', 
        geometryName: 'the_geom',           
        extractAttributes: true,
        srsName: 'EPSG:27700',
        isBaseLayer: false,
        visibility: true,
        schema: ';typename=cite:ODC_Private_Graphics_Data',


    //This function will be invoked when I click on save image in web map application 
 function saveFeature() { 
  for (var ss = 0; ss < wfs.selectedFeatures.length; ss++) {
      var selFeat = wfs.selectedFeatures[ss];

      selFeat.attributes.FeatureName = 'Test';
       selFeat.state = OpenLayers.State.UPDATE;

function delFeature() {
if (wfs.selectedFeatures.length > 0) {
for (var dd = 0; dd < wfs.selectedFeatures.length; dd++) {
     var selFeat = wfs.selectedFeatures[dd];
     if (selFeat.fid == undefined) {
        } else {
        selFeat.state = OpenLayers.State.DELETE;"afterfeaturemodified", { feature: selFeat });
        selFeat.renderIntent = "select";

 function ChangesSuccess() {

 function ChangesFailed() {
share|improve this question

Only clues here: difficult to help you when not easy to reproduce on my own

  • Did you set the proxy?
  • Using the OpenLayers call, did you try to debug the save part only on your server side (GeoServer)? You can do that by using a tool like Fiddler Windows only) or Charles (not free) You have to catch the call, replay it and make modifications. You can also use the Firefox or Google Chrome "Copy as CURL" functions ( to do the same. You will be able to play on the featureNS or featurePrefix parameters. When your tests will be done on server side (and work), you will just have to make modifications in your OpenLayers code to make things work.
share|improve this answer
Now its save the changes in postgis. But when we viewing it again, geoserver returns the error "Internal error occurred null ERROR: Operation on two geometries with different SRIDs". I checked in postgis table, there is no different SRID, all are in 404000. I have used the below queries to check and update the SRIDS. SELECT ST_SRID(the_geom) FROM "ODC_Private_Graphics_Data" LIMIT 100; UPDATE "ODC_Private_Graphics_Data" SET the_geom = ST_Transform(the_geom,404000); UPDATE "ODC_Private_Graphics_Data" SET the_geom = ST_SetSRID(the_geom, 404000); – venkat Nov 4 '13 at 10:41
I need to store Polygon,Point and LineString in ODC_Private_Graphics_Data table.Kindly suggest me. – venkat Nov 4 '13 at 10:44
You have two place for SRID: at the geometry_columns table (or view for PostGIS 2.0). But you also have to set your SRID in the geometry of each database record. Do something like UPDATE yourTable set the_geom = ST_setSRID(the_geom, yourSRIDdeclaredInGeoServer); Your error is clearly due to this mismatch. Does your SRID is present in PostGIS spatial_ref_sys? And in your Geos EPSG declaration file (for transformation, PostGIS is using Geos and if SRID is not set, it will not work well) – ThomasG77 Nov 4 '13 at 18:30
Yes thanks Thomas.As per your instruction now Insert,Update and Delete Geometry is working. But Update with Attributes is not working.I have updated the code above. (saveFeature) Now problem in update attribute or inserting feature with attribute. If it is fixed, my all issue will be solved.Kindly help me plz – venkat Nov 5 '13 at 10:14
Thanks Thomas everything is working fine now.I did small mistake in geoserver thats what i cant update the attribute. I forget to reload the feature type in geoserver after added the new attribute column in postgis. – venkat Nov 5 '13 at 11:29

Your Answer


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.