I have a webpage that displays a GeoTIFF served via GeoServer as an OpenLayers3 ImageWMS
. What I need is to (via a button) reload the OL3 layer after the underlying GeoTIFF changes.
I searched around, and tried
layer.dispatchChangeEvent();
on the layer in question. But the map/image isn't updated.
I have also tried removing the layer, constructing a new layer and add it back. It didn't work either.
The only thing that works is to reload the whole webpage, in which case the map shows the new image but all states in the page is lost.
My question is
How can I reload the layer without having to reload the whole page?
Thanks
To reload data from the server (ie the source), you have to call
layer.getSource().dispatchChangeEvent();
in v3.0.0. Note that current master and the upcoming v3.1.0 version use
layer.getSource().changed();
instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.