@@ -430,6 +430,15 @@ function moveTerminator() { // if terminator line plotted move it every minute
430
430
}
431
431
setInterval ( function ( ) { moveTerminator ( ) } , 60000 ) ;
432
432
433
+ // move the rainfall overlay (if enabled) every 10 minutes
434
+ function moveRainfall ( ) {
435
+ if ( map . hasLayer ( overlays [ "rainfall" ] ) ) {
436
+ overlays [ "rainfall" ] [ "_url" ] = 'https://tilecache.rainviewer.com/v2/radar/' + parseInt ( Date . now ( ) / 600000 ) * 600 + '/256/{z}/{x}/{y}/2/1_1.png' ;
437
+ overlays [ "rainfall" ] . redraw ( ) ;
438
+ }
439
+ }
440
+ setInterval ( function ( ) { moveRainfall ( ) } , 600000 ) ;
441
+
433
442
function setCluster ( v ) {
434
443
clusterAt = v || 0 ;
435
444
console . log ( "clusterAt set:" , clusterAt ) ;
@@ -1037,40 +1046,48 @@ overlays["countries"] = layers["_countries"];
1037
1046
layers [ "_daynight" ] = new L . LayerGroup ( ) ;
1038
1047
overlays [ "day/night" ] = layers [ "_daynight" ] ;
1039
1048
1040
- // Add the heatmap layer
1041
- var heat = L . heatLayer ( [ ] , { radius :60 , gradient :{ 0.2 :'blue' , 0.4 :'lime' , 0.6 :'red' , 0.8 :'yellow' , 1 :'white' } } ) ;
1042
- layers [ "_heat" ] = new L . LayerGroup ( ) . addLayer ( heat ) ;
1043
- overlays [ "heatmap" ] = layers [ "_heat" ] ;
1049
+ // Add live rain data
1050
+ overlays [ "rainfall" ] = new L . TileLayer ( 'https://tilecache.rainviewer.com/v2/radar/' + parseInt ( Date . now ( ) / 600000 ) * 600 + '/256/{z}/{x}/{y}/2/1_1.png' , {
1051
+ tileSize : 256 ,
1052
+ opacity : 0.4 ,
1053
+ transparent : true ,
1054
+ attribution : '<a href="https://rainviewer.com" target="_blank">rainviewer.com</a>'
1055
+ } ) ;
1044
1056
1045
1057
// Add the buildings layer
1046
- overlays [ "buildings" ] = new OSMBuildings ( map ) . load ( ) ;
1047
- map . removeLayer ( overlays [ "buildings" ] ) ; // Hide it at start
1058
+ // overlays["buildings"] = new OSMBuildings(map).load();
1059
+ // map.removeLayer(overlays["buildings"]); // Hide it at start
1048
1060
1049
1061
// Add Roads
1050
- overlays [ "roads" ] = L . tileLayer ( 'https://{s}.tile.openstreetmap.se/hydda/roads_and_labels/{z}/{x}/{y}.png' , {
1051
- maxZoom : 18 ,
1052
- attribution : 'Tiles courtesy of <a href="https://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>' ,
1053
- opacity : 0.8
1054
- } ) ;
1062
+ // overlays["roads"] = L.tileLayer('https://{s}.tile.openstreetmap.se/hydda/roads_and_labels/{z}/{x}/{y}.png', {
1063
+ // maxZoom: 18,
1064
+ // attribution: 'Tiles courtesy of <a href="https://openstreetmap.se/" target="_blank">OpenStreetMap Sweden</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
1065
+ // opacity: 0.8
1066
+ // });
1055
1067
1056
- // Add Railways
1057
- overlays [ "railways" ] = L . tileLayer ( 'https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png' , {
1058
- maxZoom : 19 ,
1059
- attribution : 'Map data: © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | Map style: © <a href="https://www.OpenRailwayMap.org">OpenRailwayMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
1060
- } ) ;
1068
+ // // Add Railways
1069
+ // overlays["railways"] = L.tileLayer('https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png', {
1070
+ // maxZoom: 19,
1071
+ // attribution: 'Map data: © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | Map style: © <a href="https://www.OpenRailwayMap.org">OpenRailwayMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
1072
+ // });
1061
1073
1062
- // Add Public Transport (Buses)
1063
- overlays [ "public transport" ] = L . tileLayer ( 'https://openptmap.org/tiles/{z}/{x}/{y}.png' , {
1064
- maxZoom : 17 ,
1065
- attribution : 'Map data: © <a href="https://www.openptmap.org">OpenPtMap</a> contributors'
1066
- } ) ;
1074
+ // // Add Public Transport (Buses)
1075
+ // overlays["public transport"] = L.tileLayer('https://openptmap.org/tiles/{z}/{x}/{y}.png', {
1076
+ // maxZoom: 17,
1077
+ // attribution: 'Map data: © <a href="https://www.openptmap.org">OpenPtMap</a> contributors'
1078
+ // });
1067
1079
1068
1080
// Add the OpenSea markers layer
1069
1081
overlays [ "ship nav" ] = L . tileLayer ( 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png' , {
1070
1082
maxZoom : 19 ,
1071
1083
attribution : 'Map data: © <a href="https://www.openseamap.org">OpenSeaMap</a> contributors'
1072
1084
} ) ;
1073
1085
1086
+ // Add the heatmap layer
1087
+ var heat = L . heatLayer ( [ ] , { radius :60 , gradient :{ 0.2 :'blue' , 0.4 :'lime' , 0.6 :'red' , 0.8 :'yellow' , 1 :'white' } } ) ;
1088
+ layers [ "_heat" ] = new L . LayerGroup ( ) . addLayer ( heat ) ;
1089
+ overlays [ "heatmap" ] = layers [ "_heat" ] ;
1090
+
1074
1091
if ( showUserMenu ) {
1075
1092
if ( window . localStorage . hasOwnProperty ( "lastlayer" ) ) {
1076
1093
if ( basemaps [ window . localStorage . getItem ( "lastlayer" ) ] ) {
0 commit comments