0

I am trying to update feature to geoserver using WFST ol3. I could successfully able to update feature information to geoserver, but after the update, if i refresh the application, the updated feature alone is not visible in map. But i confirmed that the update worked by using my customized query toool which displays attribute information based on the query made by the user

this.save = function(p,feature_attribute) {
        var layer = 'geowebmap_ws:tn_water';
        self.layerName = 'tn_water';
        var feature_type = self.layerName;
        var formatWFS = new ol.format.WFS();
        var formatGML = new ol.format.GML2({
            featureNS: base_URL+'web/geowebmap_ws',
            featureType: feature_type,
            srsName: 'EPSG:3857'
        });
        geom = null;
        geomtype = null;
        self.feat_att = [];
        var self.feat_att = $$hashKey: "object:722"
                            geometry: Object
                            coordinates: Array[2]
                              0: 8682209.29541959
                              1: 1159929.44262119
                             length: 2
                             type: "Point"
                             geometry_name: "the_geom"
                             id: "tn_poi.308"
                             properties: Object
                               CATEGORY: "Automotive update test"
                               NAME: "Level crossing"
                             type: "Feature
        for (var i in self.feat_att) {

            geomtype = self.feat_att[i].geometry.type;
            switch(geomtype) {
                case "Point":
                    geom = self.feat_att[i].geometry.coordinates;
                    feature =  new ol.geom.Point([geom]);
                    break;
                case "MultiPoint":
                     feature = new ol.geom.MultiPoint([geom]);
                     break;
                case "LineString":
                     feature = new ol.geom.LineString([geom]);
                     break;
                case "MultiLineString":
                     geom = self.feat_att[i].geometry.coordinates[0];
                     feature = new ol.geom.MultiLineString([geom]);
                     break;
                case "Polygon":
                     feature = new ol.geom.Polygon([geom]);
                     break;
                case "MultiPolygon":
                      geom = self.feat_att[i].geometry.coordinates[0];
                      feature = new ol.geom.MultiPolygon([geom]);
                      break;

            }
            var att_columns = self.feat_att[i].properties
            var featobj = {the_geom:feature}
            var attobj = $.extend(featobj, att_columns)
            var featurething = new ol.Feature(attobj)
            var featid = self.feat_att[i].id


            node =  formatWFS.writeTransaction(null, [featurething], null, formatGML);
            s =  new XMLSerializer();
            str = s.serializeToString(node);
            var feat_data=str.replace("feature:"+feature_type,self.selected_layer);
            console.log(feat_data);
            $.ajax(base_URL+'geowebmap_ws/ows', {
                type: 'POST',
                dataType: 'xml',
                processData: false,
                contentType: 'text/xml',
                data: feat_data,
                error: function (xhr) {
                   var err = JSON.parse(xhr.responseText);
                   alert(err.message);
                }
            }).done();


        }





    }
  • 1
    More a clue but if you are using PostGIS, try to see coordinates from your geometry column with something like SELECT ST_AsText(your_geom_column) FROM your_table I'm nearly sure that you update your geometry with wrong coordinates (in the sense of wrong projection) – ThomasG77 May 29 '18 at 15:54

Your Answer

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

Browse other questions tagged or ask your own question.