Openlayers-3 Force map update
I have a custom style that shows / hides features on the map, but when applied, it doesn't get activated until the map is refreshed due to a feature update, but I need it to fire immediately.
I tried map.render and renderSync () but they didn't do anything. mapResize () doesn't do anything either, but if I wait for the function to update or move the map, it works.
Any ideas? How can I force the map to redraw on demand, regardless of the function update?
+3
source to share
5 answers
I believe you need to force the source of the layer to update, you can do this by calling a function on it changed
:
yourLayer.getSource().changed();
see http://openlayers.org/en/v3.6.0/apidoc/ol.source.Source.html
+7
source to share