Refresh the nexrad tiles every 5 mins.
This commit is contained in:
parent
8766a58811
commit
bc8ba5b73a
|
@ -66,17 +66,26 @@ function createBaseLayers() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
us.push(new ol.layer.Tile({
|
var nexrad = new ol.layer.Tile({
|
||||||
name: 'nexrad',
|
name: 'nexrad',
|
||||||
title: 'NEXRAD',
|
title: 'NEXRAD',
|
||||||
type: 'overlay',
|
type: 'overlay',
|
||||||
source: new ol.source.XYZ({
|
|
||||||
url : 'http://mesonet{1-3}.agron.iastate.edu/cache/tile.py/1.0.0/nexrad-n0q-900913/{z}/{x}/{y}.png',
|
|
||||||
attributions: 'NEXRAD courtesy of <a href="http://mesonet.agron.iastate.edu/">IEM</a>'
|
|
||||||
}),
|
|
||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
visible: false
|
visible: false
|
||||||
}));
|
});
|
||||||
|
us.push(nexrad);
|
||||||
|
|
||||||
|
var refreshNexrad = function() {
|
||||||
|
// re-build the source to force a refresh of the nexrad tiles
|
||||||
|
var now = new Date().getTime();
|
||||||
|
nexrad.setSource(new ol.source.XYZ({
|
||||||
|
url : 'http://mesonet{1-3}.agron.iastate.edu/cache/tile.py/1.0.0/nexrad-n0q-900913/{z}/{x}/{y}.png?_=' + now,
|
||||||
|
attributions: 'NEXRAD courtesy of <a href="http://mesonet.agron.iastate.edu/">IEM</a>'
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
refreshNexrad();
|
||||||
|
window.setInterval(refreshNexrad, 5 * 60000);
|
||||||
|
|
||||||
if (world.length > 0) {
|
if (world.length > 0) {
|
||||||
layers.push(new ol.layer.Group({
|
layers.push(new ol.layer.Group({
|
||||||
|
|
Loading…
Reference in a new issue