Open Layers 3: How to create a listener to change interaction

I was able to configure the interaction.

Documents for ol.interaction.Modify ( http://ol3js.org/en/master/apidoc/ol.interaction.Modify.html ) not Metion is one event that fires when a function is modified.

Unlike, for example, for ol.interaction.Draw ( http://ol3js.org/en/master/apidoc/ol.interaction.Draw.html ), which works well.

I need to update the coordinates in the database when the function was changed.

How to set up a listener?

+4
source share
2 answers

I have found a solution.

: http://boundlessgeo.com/2014/06/openlayers-editing-wfs-t/

, ( ). .

:

// get the features from the select interaction
var selected_features = select_interaction.getFeatures();
// when a feature is selected...
selected_features.on('add', function(event) {
    // get the feature
    var feature = event.element;
    // ...listen for changes on it
    feature.on('change', function(event) {
        // got it!
    });
});

: http://codepen.io/barbalex/pen/fBpyb

+7

, , :

feature.once('change', function(bool) {if (bool) {document.getElementById('my_input_text').value='feature changed'}})

" " 'on', , , .

+2

Source: https://habr.com/ru/post/1548273/


All Articles