The assignment will be quite simple because the component at the time of writing needs some refining. It's possible to edit content but there are no events to catch at the end of modification: we will be unable to save the modified features. We will cover the client as is.
Copy the first sample
2360_08_01_simple_select.html
as2360_08_08_modify.html
.Before
var london
, add the following code:var modify = new ol.interaction.Modify({ features: selectInteraction.getFeatures() });
Replace
map.getInteractions().extend([selectInteraction]);
with the following code:map.getInteractions().extend([selectInteraction, modify]);
Add the following code to manage features change:
var selected_features = selectInteraction.getFeatures(); selected_features.on('add', function(event) { var feature = event.element; feature.on('change', function(event){ event.target.getGeometry().getCoordinates()); }); });
Open the new sample, select a feature...