I am trying to add new features to a vector layer.
I do it with this code:
layer.getSource().addFeatures(features);
Where layer is an instance of ol.vector.Layer and features is an array of ol.Feature
The features are added but they are not visible. And unfortunately even calling
map.render()
does not help. The only solution that works is reloading all features for the layer:
layer.getSource().clear();
view = map.getView();
layer.getSource().loadFeatures(map.getExtent(), view.getResolution(), view.getProjection());
But it is quite annoying to wait for the whole layer reload each time you want to add a feature.
Any ideas what I might be doing wrong ?