OpenLayers循环层函数
OpenLayers loop layers function
在 OpenLayers 中,我有一个按钮(显示),当我按下它时,我在地图上得到了一个图层
我的问题:如何在一定的帧率下同时显示多个图层
(有点像循环!)
要每隔 X 秒显示一个 new/other 图层,请使用 setInterval
让我们假设您以某种方式获得了一组具有切片的日期,以及一个可以显示图层的函数 displayLayerByDate(dateObject)
。
function animatedLayers(arrayOfDates) {
let currentIdx = 0;
const handle = setInterval(function() {
const currentDate = arrayOfDates[currentIdx];
displayLayerByDate(dateObject);
}, 5000);
}
在 OpenLayers 中,我有一个按钮(显示),当我按下它时,我在地图上得到了一个图层
我的问题:如何在一定的帧率下同时显示多个图层 (有点像循环!)
要每隔 X 秒显示一个 new/other 图层,请使用 setInterval
让我们假设您以某种方式获得了一组具有切片的日期,以及一个可以显示图层的函数 displayLayerByDate(dateObject)
。
function animatedLayers(arrayOfDates) {
let currentIdx = 0;
const handle = setInterval(function() {
const currentDate = arrayOfDates[currentIdx];
displayLayerByDate(dateObject);
}, 5000);
}