0

I am working on WFS-T update.below is the code I am using to update modified data

   map.addInteraction(interactionSelect);
        interaction = new ol.interaction.Modify({
            features: interactionSelect.getFeatures()
        });
        map.addInteraction(interaction);
        map.addInteraction(interactionSnap);
        dirty = {};
        interactionSelect.getFeatures().on('add', function (e) {
            e.element.on('change', function (e) {
                dirty[e.target.getId()] = true;
            });
        });

        interactionSelect.getFeatures().on('remove', function (e) {
            var f = e.element;
            if (dirty[f.getId()]) {
                delete dirty[f.getId()];
                var featureProperties = f.getProperties();
                delete featureProperties.boundedBy;
                var clone = new ol.Feature(featureProperties);
                clone.setId(f.getId());
                transactWFS_polygon('update', clone);
            }
        });

before calling transactWFS_polygon function i need to transform projection to 4326. The movement I modified feature its not visible.When I reload page also data is not visible. My post request parameter:

<Transaction xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Update typeName="feature:polygon" xmlns:feature="http://spatial_editing"><Property><Name>gid</Name><Value>7</Value></Property><Property><Name>geometry</Name><Value><MultiPolygon xmlns="http://www.opengis.net/gml"><polygonMember><Polygon><exterior><LinearRing><posList>8355484.43590919 1768447.08640584 8267428.979324663 1719527.388303325 8370160.34533994 1684060.607179 8393397.20193863 1697513.52415719 8397066.17929632 1718304.39585076 8375052.31515019 1720750.38075589 8392174.20948607 1757440.15433277 8355484.43590919 1768447.08640584</posList></LinearRing></exterior></Polygon></polygonMember></MultiPolygon></Value></Property><Filter xmlns="http://www.opengis.net/ogc"><FeatureId fid="polygon.7"/></Filter></Update></Transaction>

Update1

Please check with jsFiddler same code i am using for WFS-T edit,delete and update.Every thing working except update.can any one tell me whats wrong here.layers are in local host so not displaying there

  • It should be OK to use your geometry as it is if you just told in the GML the srsName. Something like <MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#3857". I suppose that valid GML 3 would require also srsDimension="2" so that posList can be interpreted right but perhaps your server is using 2D as default. – user30184 Mar 15 '17 at 13:03
  • You mean to say that var formatGML_polygon = new ol.format.GML({ featureNS: 'http://spatial_editing', featureType: 'polygon', srsName: 'EPSG:3857' }); here I need to change srsname to 4326 – veena hosur Mar 16 '17 at 5:02

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.