hide default online layer options if we aren't online
This commit is contained in:
parent
9b7fa84554
commit
d4cdc48a2f
@ -1,5 +1,6 @@
|
||||
### Change Log for Node-RED Worldmap
|
||||
|
||||
- v2.12.1 - Only show online layer options if we are online.
|
||||
- v2.12.0 - Add live rainfall radar data layer. Remove some non-loading overlays.
|
||||
- v2.11.2 - Allow thicknesss of arc to be specified by weight
|
||||
- v2.11.1 - Better handle KML point info - add popup.
|
||||
|
@ -11,6 +11,7 @@ map web page for plotting "things" on.
|
||||
|
||||
### Updates
|
||||
|
||||
- v2.12.1 - Only show online layer options if we are online.
|
||||
- v2.12.0 - Add live rainfall radar data layer. Remove some non-loading overlays.
|
||||
- v2.11.2 - Allow thicknesss of arc to be specified by weight
|
||||
- v2.11.1 - Better handle KML point info - add popup.
|
||||
@ -565,7 +566,10 @@ Again the boolean `fit` property can be added to make the map zoom to the releva
|
||||
"displayOptions": {
|
||||
"velocityType": "Global Wind",
|
||||
"displayPosition": "bottomleft",
|
||||
"displayEmptyString": "No wind data"
|
||||
"emptyString": "No wind data",
|
||||
"showCardinal": true,
|
||||
"speedUnit": "k/h",
|
||||
"angleConvention": "meteoCCW"
|
||||
},
|
||||
"maxVelocity": 15,
|
||||
"data": [Array of data as per format referenced below]
|
||||
@ -574,6 +578,8 @@ Again the boolean `fit` property can be added to make the map zoom to the releva
|
||||
|
||||
see https://github.com/danwild/leaflet-velocity for more details about options and data examples.
|
||||
|
||||
Note: If you use his wind-js-server you need to patch it as per [issue 9](https://github.com/danwild/wind-js-server/issues/9).
|
||||
|
||||
#### To add an Image Overlay
|
||||
|
||||
in a function node:
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-contrib-web-worldmap",
|
||||
"version": "2.12.0",
|
||||
"version": "2.12.1",
|
||||
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
||||
"dependencies": {
|
||||
"cgi": "0.3.1",
|
||||
|
2
worldmap/leaflet/leaflet-velocity.min.js
vendored
2
worldmap/leaflet/leaflet-velocity.min.js
vendored
File diff suppressed because one or more lines are too long
@ -432,7 +432,7 @@ setInterval( function() { moveTerminator() }, 60000 );
|
||||
|
||||
// move the rainfall overlay (if enabled) every 10 minutes
|
||||
function moveRainfall() {
|
||||
if (map.hasLayer(overlays["rainfall"])) {
|
||||
if (navigator.onLine && map.hasLayer(overlays["rainfall"])) {
|
||||
overlays["rainfall"]["_url"] = 'https://tilecache.rainviewer.com/v2/radar/' + parseInt(Date.now()/600000)*600 + '/256/{z}/{x}/{y}/2/1_1.png';
|
||||
overlays["rainfall"].redraw();
|
||||
}
|
||||
@ -734,6 +734,7 @@ map.on('contextmenu', function(e) {
|
||||
});
|
||||
|
||||
// Add all the base layer maps
|
||||
if (navigator.onLine) {
|
||||
|
||||
// Use this for OSM online maps
|
||||
var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
@ -741,6 +742,7 @@ var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
var osmAttrib='Map data © OpenStreetMap contributors';
|
||||
var osmg = new L.TileLayer.Grayscale(osmUrl, {attribution:osmAttrib, maxNativeZoom:19, maxZoom:20});
|
||||
basemaps["OSM grey"] = osmg;
|
||||
|
||||
var osm = new L.TileLayer(osmUrl, {attribution:osmAttrib, maxNativeZoom:19, maxZoom:20});
|
||||
basemaps["OSM"] = osm;
|
||||
|
||||
@ -862,6 +864,7 @@ basemaps["Watercolor"] = L.tileLayer(watercolorUrl, {
|
||||
type: 'jpg',
|
||||
attribution: 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, under <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Now add the overlays
|
||||
@ -1047,6 +1050,7 @@ layers["_daynight"] = new L.LayerGroup();
|
||||
overlays["day/night"] = layers["_daynight"];
|
||||
|
||||
// Add live rain data
|
||||
if (navigator.onLine) {
|
||||
overlays["rainfall"] = new L.TileLayer('https://tilecache.rainviewer.com/v2/radar/' + parseInt(Date.now()/600000)*600 + '/256/{z}/{x}/{y}/2/1_1.png', {
|
||||
tileSize: 256,
|
||||
opacity: 0.4,
|
||||
@ -1082,6 +1086,7 @@ overlays["ship nav"] = L.tileLayer('https://tiles.openseamap.org/seamark/{z}/{x}
|
||||
maxZoom: 19,
|
||||
attribution: 'Map data: © <a href="https://www.openseamap.org">OpenSeaMap</a> contributors'
|
||||
});
|
||||
}
|
||||
|
||||
// Add the heatmap layer
|
||||
var heat = L.heatLayer([], {radius:60, gradient:{0.2:'blue', 0.4:'lime', 0.6:'red', 0.8:'yellow', 1:'white'}});
|
||||
@ -1095,7 +1100,7 @@ if (showUserMenu) {
|
||||
}
|
||||
}
|
||||
}
|
||||
basemaps[baselayername].addTo(map);
|
||||
if (navigator.onLine) { basemaps[baselayername].addTo(map); }
|
||||
|
||||
// Layer control based on select box rather than radio buttons.
|
||||
//var layercontrol = L.control.selectLayers(basemaps, overlays).addTo(map);
|
||||
|
Loading…
Reference in New Issue
Block a user