What is “same result”? Success or no success?

-Jukka Rahkonen-

Lähettäjä: Vikram <[email protected]>
Lähetetty: torstai 23. tammikuuta 2020 11.29
Vastaanottaja: Rahkonen Jukka (MML) <[email protected]>; 
Vitor Fonseca <[email protected]>
Kopio: geoserver-users <[email protected]>
Aihe: Re: [Geoserver-users] OpenLayers GeoServer update an array of features 
using WFS-T


Yes, I have tried this. It is an update request though. It gives me the same 
result.

-Vikram
On 22/01/2020 18:35, Rahkonen Jukka (MML) wrote:
Have you already made a test without OpenLayers by writing a WFS-T insert 
request by hand and posting it with curl, or Postman, or with the demo request 
application that comes with Geoserver?

-Jukka Rahkonen-

Lähettäjä: Vitor Fonseca <[email protected]><mailto:[email protected]>
Lähetetty: keskiviikko 22. tammikuuta 2020 12.59
Vastaanottaja: Vikram 
<[email protected]><mailto:[email protected]>
Kopio: geoserver-users 
<[email protected]><mailto:[email protected]>
Aihe: Re: [Geoserver-users] OpenLayers GeoServer update an array of features 
using WFS-T


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]<mailto:[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]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/geoserver-users


--
[Lähettäjä poisti kuvan.]
www.vfonsecaz.pt<http://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

Reply via email to