[英]OpenLayers3 - How to redraw or refresh a WMS Layer?
I'm working on a kind-of live map. 我正在制作一种实时地图。
From times to times, is necessary to refresh the layer to get the refreshed content (as the page does not reload). 有时需要刷新层以获取刷新的内容(因为页面不会重新加载)。
I tried to remove/add the layer again with setInterval
but the layer is not added again. 我尝试使用
setInterval
再次删除/添加该层,但是没有再次添加该层。
setInterval(function() {
map.removeLayer(layer);
map.addLayer(layer);
}, 10000);
There is a way to do this? 有办法吗?
I figure out that setting a timeout before the addLayer
do the job. 我发现在
addLayer
做这项工作之前设置超时。 It just smells a little bit. 闻起来有点香。
setInterval(function() {
map.removeLayer(layer);
setTimeout(function() {
map.addLayer(layer);
}, 100);
}, 10000);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.