Hi, I think this is a programming problem rather than a Geoserver problem. >From my experience the issue should be with the *clone* functionality.
Check this https://gis.stackexchange.com/questions/46730/openlayers-cloned-features-get-style-from-original-feature Someone mentions "I have noticed that cloned features share the same featureID as the original. " and this should be the problem when sending the features over to WFS-T... You could try creating new features some other way (wkt...) Vikram <[email protected]> escreveu no dia quarta, 22/01/2020 à(s) 10:24: > HI all, > > I am trying to update features using WFS-T update. I am sending the > request from my website (OpenLayers) by passing an array of features. > > However, I have noticed that the attributes and geometry of last feature > in the array is copied to all other features. > > For example, if I pass 5 features to the writeTransaction method to > update an attribute of all 5 features, it copies the attributes and > geometry of the 5th feature to the other features. > > var clones = [] > selectedFeatures.forEach(function (feature) { > var featureProperties = feature.getProperties(); > > delete featureProperties.boundedBy; > var clone = feature.clone(); > clone.setId(feature.getId()); > > clone.setGeometryName('the_geom'); > > clone.setProperties({'xyz':'xyz'}) > > clones.push(clone) > > > }) > console.log(clones) > transactWFS('update_batch', clones); > > int the transactWFS method, > > transactWFS = function (mode, f) { > > var node; > switch (mode) { > case 'insert': > node = formatWFS.writeTransaction([f], null, null, formatGML); > break; > case 'update': > node = formatWFS.writeTransaction(null, [f], null, formatGML); > break; > case 'update_batch': > node = formatWFS.writeTransaction(null, f, null, formatGML); > break; > case 'delete': > node = formatWFS.writeTransaction(null, null, [f], formatGML); > break; > } > var payload = xs.serializeToString(node); > > $.ajax('http://localhost:8080/geoserver/TEST/ows', { > service: 'WFS', > type: 'POST', > dataType: 'xml', > processData: false, > contentType: 'text/xml', > data: payload, > success: function(data) { > > }, > error: function(e) { > var errorMsg = e? (e.status + ' ' + e.statusText) : ""; > alert('Error saving this feature to GeoServer.<br><br>' > + errorMsg); > } > }).done(function() { > wfsSource.refresh() > > });}; > > Does anyone have a solution? > > Regards, > > Vikram > _______________________________________________ > Geoserver-users mailing list > > Please make sure you read the following two resources before posting to > this list: > - Earning your support instead of buying it, but Ian Turton: > http://www.ianturton.com/talks/foss4g.html#/ > - The GeoServer user list posting guidelines: > http://geoserver.org/comm/userlist-guidelines.html > > If you want to request a feature or an improvement, also see this: > https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer > > > [email protected] > https://lists.sourceforge.net/lists/listinfo/geoserver-users > -- www.vfonsecaz.pt
_______________________________________________ Geoserver-users mailing list Please make sure you read the following two resources before posting to this list: - Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/ - The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
