[GIS] Modify attributes of WFS layer in OpenLayers 3

openlayerswfs-t

I need to modofy attributes of features appeared on a map using OL3.
The features live in a postigs db and they are serverd through Geoserver.
What I want is to modify some of the non spatial attributes of each feature.

What I did in order to accomplish this is to create a menu in which the user selects the values he wants to modify for a specific feature and then save the changes with a button. On button click I would send an ajax request (jquery/php) in which I would update the table values based on the fid of the table.

If I understand correctly using WFS-T is a more appropriate way. Is that right? Can I change non spatial attribute values with WFS-T? If yes, is there an example using OL3?

Best Answer

Yes WFS-T is more appropriate and can be used to edit non spatial attributes as well. Look at: http://openlayers.org/en/v3.14.2/apidoc/ol.format.WFS.html#writeTransaction on how to generate the payload.