Skip to content

Commit 9b7fa84

Browse files
author
Dave Conway-Jones
committed
add rainfall overlay - remove old overlays that don't load
1 parent 3dfa46e commit 9b7fa84

File tree

4 files changed

+43
-24
lines changed

4 files changed

+43
-24
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### Change Log for Node-RED Worldmap
22

3-
- v2.11.2 - allow thicknesss of arc to be specified by weight
3+
- v2.12.0 - Add live rainfall radar data layer. Remove some non-loading overlays.
4+
- v2.11.2 - Allow thicknesss of arc to be specified by weight
45
- v2.11.1 - Better handle KML point info - add popup.
56
- v2.11.0 - Add option to smooth tracks using bezier curves.
67
- v2.10.0 - Save latest position to browser for refresh if in iframe/dashboard. Allow fractional Zoom levels.

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ map web page for plotting "things" on.
1111

1212
### Updates
1313

14-
- v2.11.2 - allow thicknesss of arc to be specified by weight
14+
- v2.12.0 - Add live rainfall radar data layer. Remove some non-loading overlays.
15+
- v2.11.2 - Allow thicknesss of arc to be specified by weight
1516
- v2.11.1 - Better handle KML point info - add popup.
1617
- v2.11.0 - Add option to smooth tracks using bezier curves.
1718
- v2.10.0 - Save latest position to browser for refresh if in iframe/dashboard. Allow fractional Zoom levels.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-contrib-web-worldmap",
3-
"version": "2.11.2",
3+
"version": "2.12.0",
44
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
55
"dependencies": {
66
"cgi": "0.3.1",

worldmap/worldmap.js

+38-21
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,15 @@ function moveTerminator() { // if terminator line plotted move it every minute
430430
}
431431
setInterval( function() { moveTerminator() }, 60000 );
432432

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+
433442
function setCluster(v) {
434443
clusterAt = v || 0;
435444
console.log("clusterAt set:",clusterAt);
@@ -1037,40 +1046,48 @@ overlays["countries"] = layers["_countries"];
10371046
layers["_daynight"] = new L.LayerGroup();
10381047
overlays["day/night"] = layers["_daynight"];
10391048

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+
});
10441056

10451057
// 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
10481060

10491061
// 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> &mdash; Map data &copy; <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> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
1065+
// opacity: 0.8
1066+
// });
10551067

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: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | Map style: &copy; <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: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | Map style: &copy; <a href="https://www.OpenRailwayMap.org">OpenRailwayMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)'
1072+
// });
10611073

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: &copy; <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: &copy; <a href="https://www.openptmap.org">OpenPtMap</a> contributors'
1078+
// });
10671079

10681080
// Add the OpenSea markers layer
10691081
overlays["ship nav"] = L.tileLayer('https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', {
10701082
maxZoom: 19,
10711083
attribution: 'Map data: &copy; <a href="https://www.openseamap.org">OpenSeaMap</a> contributors'
10721084
});
10731085

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+
10741091
if (showUserMenu) {
10751092
if ( window.localStorage.hasOwnProperty("lastlayer") ) {
10761093
if ( basemaps[window.localStorage.getItem("lastlayer")] ) {

0 commit comments

Comments
 (0)