hide default online layer options if we aren't online

This commit is contained in:
Dave Conway-Jones 2021-03-26 17:11:10 +00:00
parent 9b7fa84554
commit d4cdc48a2f
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
5 changed files with 158 additions and 146 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap ### 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.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.2 - Allow thicknesss of arc to be specified by weight
- v2.11.1 - Better handle KML point info - add popup. - v2.11.1 - Better handle KML point info - add popup.

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates ### 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.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.2 - Allow thicknesss of arc to be specified by weight
- v2.11.1 - Better handle KML point info - add popup. - v2.11.1 - Better handle KML point info - add popup.
@ -562,10 +563,13 @@ Again the boolean `fit` property can be added to make the map zoom to the releva
"overlay": "myWind", "overlay": "myWind",
"velocity": { "velocity": {
"displayValues": true, "displayValues": true,
"displayOptions": { "displayOptions": {
"velocityType": "Global Wind", "velocityType": "Global Wind",
"displayPosition": "bottomleft", "displayPosition": "bottomleft",
"displayEmptyString": "No wind data" "emptyString": "No wind data",
"showCardinal": true,
"speedUnit": "k/h",
"angleConvention": "meteoCCW"
}, },
"maxVelocity": 15, "maxVelocity": 15,
"data": [Array of data as per format referenced below] "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. 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 #### To add an Image Overlay
in a function node: in a function node:

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-web-worldmap", "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.", "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": { "dependencies": {
"cgi": "0.3.1", "cgi": "0.3.1",

File diff suppressed because one or more lines are too long

View File

@ -432,7 +432,7 @@ setInterval( function() { moveTerminator() }, 60000 );
// move the rainfall overlay (if enabled) every 10 minutes // move the rainfall overlay (if enabled) every 10 minutes
function moveRainfall() { 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"]["_url"] = 'https://tilecache.rainviewer.com/v2/radar/' + parseInt(Date.now()/600000)*600 + '/256/{z}/{x}/{y}/2/1_1.png';
overlays["rainfall"].redraw(); overlays["rainfall"].redraw();
} }
@ -734,134 +734,137 @@ map.on('contextmenu', function(e) {
}); });
// Add all the base layer maps // Add all the base layer maps
if (navigator.onLine) {
// Use this for OSM online maps // Use this for OSM online maps
var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; var osmUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
//var osmUrl='https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png'; //var osmUrl='https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png';
var osmAttrib='Map data © OpenStreetMap contributors'; var osmAttrib='Map data © OpenStreetMap contributors';
var osmg = new L.TileLayer.Grayscale(osmUrl, {attribution:osmAttrib, maxNativeZoom:19, maxZoom:20}); var osmg = new L.TileLayer.Grayscale(osmUrl, {attribution:osmAttrib, maxNativeZoom:19, maxZoom:20});
basemaps["OSM grey"] = osmg; basemaps["OSM grey"] = osmg;
var osm = new L.TileLayer(osmUrl, {attribution:osmAttrib, maxNativeZoom:19, maxZoom:20});
basemaps["OSM"] = osm;
// Extra Leaflet map layers from https://leaflet-extras.github.io/leaflet-providers/preview/ var osm = new L.TileLayer(osmUrl, {attribution:osmAttrib, maxNativeZoom:19, maxZoom:20});
var Esri_WorldStreetMap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', { basemaps["OSM"] = osm;
attribution: 'Tiles © Esri', maxNativeZoom:19, maxZoom:20
});
basemaps["Esri"] = Esri_WorldStreetMap;
var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { // Extra Leaflet map layers from https://leaflet-extras.github.io/leaflet-providers/preview/
//var Esri_WorldImagery = L.tileLayer('http://clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { var Esri_WorldStreetMap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
attribution:'Tiles © Esri', maxNativeZoom:17, maxZoom:20 attribution: 'Tiles © Esri', maxNativeZoom:19, maxZoom:20
}); });
basemaps["Esri Satellite"] = Esri_WorldImagery; basemaps["Esri"] = Esri_WorldStreetMap;
var Esri_WorldTopoMap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', { var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles © Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community' //var Esri_WorldImagery = L.tileLayer('http://clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
}); attribution:'Tiles © Esri', maxNativeZoom:17, maxZoom:20
basemaps["Esri Topography"] = Esri_WorldTopoMap; });
basemaps["Esri Satellite"] = Esri_WorldImagery;
// var Esri_WorldShadedRelief = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}', { var Esri_WorldTopoMap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
// attribution: 'Tiles © Esri', attribution: 'Tiles © Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community'
// maxNativeZoom:13 });
// }); basemaps["Esri Topography"] = Esri_WorldTopoMap;
// basemaps["Esri Terrain"] = Esri_WorldShadedRelief;
var Esri_OceanBasemap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}', { // var Esri_WorldShadedRelief = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles © Esri — Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri', // attribution: 'Tiles © Esri',
maxZoom: 13 // maxNativeZoom:13
}); // });
basemaps["Esri Ocean"] = Esri_OceanBasemap; // basemaps["Esri Terrain"] = Esri_WorldShadedRelief;
var Esri_WorldGrayCanvas = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}', { var Esri_OceanBasemap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles © Esri — Esri, DeLorme, NAVTEQ', attribution: 'Tiles © Esri — Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri',
maxZoom: 16 maxZoom: 13
}); });
basemaps["Esri Dark Grey"] = Esri_WorldGrayCanvas; basemaps["Esri Ocean"] = Esri_OceanBasemap;
// var OpenMapSurfer_Roads = L.tileLayer('https://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}', { var Esri_WorldGrayCanvas = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}', {
// maxZoom: 18, attribution: 'Tiles © Esri — Esri, DeLorme, NAVTEQ',
// attribution: 'Imagery from <a href="https://giscience.uni-hd.de/">University of Heidelberg</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>' maxZoom: 16
// }); });
// basemaps["Mapsurfer"] = OpenMapSurfer_Roads; basemaps["Esri Dark Grey"] = Esri_WorldGrayCanvas;
// var MapQuestOpen_OSM = L.tileLayer('https://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.{ext}', { // var OpenMapSurfer_Roads = L.tileLayer('https://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}', {
// type: 'map', // maxZoom: 18,
// ext: 'jpg', // attribution: 'Imagery from <a href="https://giscience.uni-hd.de/">University of Heidelberg</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
// attribution: 'Tiles Courtesy of <a href="https://www.mapquest.com/">MapQuest</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>', // });
// subdomains: '1234', // basemaps["Mapsurfer"] = OpenMapSurfer_Roads;
// maxNativeZoom: 17
// });
//basemaps["MapQuest OSM"] = MapQuestOpen_OSM;
var Esri_NatGeoWorldMap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', { // var MapQuestOpen_OSM = L.tileLayer('https://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.{ext}', {
attribution: 'Tiles &copy; Esri', // type: 'map',
maxNativeZoom:12 // ext: 'jpg',
}); // attribution: 'Tiles Courtesy of <a href="https://www.mapquest.com/">MapQuest</a> &mdash; Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
basemaps["Nat Geo"] = Esri_NatGeoWorldMap; // subdomains: '1234',
// maxNativeZoom: 17
// });
//basemaps["MapQuest OSM"] = MapQuestOpen_OSM;
var NLS_OS_opendata = L.tileLayer('https://geo.nls.uk/maps/opendata/{z}/{x}/{y}.png', { var Esri_NatGeoWorldMap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
attribution: '<a href="https://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>', attribution: 'Tiles &copy; Esri',
bounds: [[49.6, -12], [61.7, 3]], maxNativeZoom:12
minZoom:1, maxNativeZoom:18, maxZoom:18, });
subdomains: '0123' basemaps["Nat Geo"] = Esri_NatGeoWorldMap;
});
basemaps["UK OS Opendata"] = NLS_OS_opendata;
var Open_Topo_Map = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', { var NLS_OS_opendata = L.tileLayer('https://geo.nls.uk/maps/opendata/{z}/{x}/{y}.png', {
subdomains: 'abc', attribution: '<a href="https://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>',
maxZoom: 19, bounds: [[49.6, -12], [61.7, 3]],
attribution: '&copy; <a href="https://www.opentopomap.org/copyright">OpenTopoMap</a> contributors' minZoom:1, maxNativeZoom:18, maxZoom:18,
}); subdomains: '0123'
basemaps["Open Topo Map"] = Open_Topo_Map; });
basemaps["UK OS Opendata"] = NLS_OS_opendata;
var HikeBike_HikeBike = L.tileLayer('https://tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png', { var Open_Topo_Map = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
maxZoom: 19, subdomains: 'abc',
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' maxZoom: 19,
}); attribution: '&copy; <a href="https://www.opentopomap.org/copyright">OpenTopoMap</a> contributors'
basemaps["Hike Bike"] = HikeBike_HikeBike; });
basemaps["Open Topo Map"] = Open_Topo_Map;
var NLS_OS_1919_1947 = L.tileLayer( 'https://nls-{s}.tileserver.com/nls/{z}/{x}/{y}.jpg', { var HikeBike_HikeBike = L.tileLayer('https://tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png', {
attribution: 'Historical Maps Layer, from <a href="https://maps.nls.uk/projects/api/">NLS Maps</a>', maxZoom: 19,
bounds: [[49.6, -12], [61.7, 3]], attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
minZoom:1, maxZoom:18, });
subdomains: '0123' basemaps["Hike Bike"] = HikeBike_HikeBike;
});
basemaps["UK OS 1919-47"] = NLS_OS_1919_1947;
//var NLS_OS_1900 = L.tileLayer('https://nls-{s}.tileserver.com/NLS_API/{z}/{x}/{y}.jpg', { var NLS_OS_1919_1947 = L.tileLayer( 'https://nls-{s}.tileserver.com/nls/{z}/{x}/{y}.jpg', {
var NLS_OS_1900 = L.tileLayer('https://nls-{s}.tileserver.com/fpsUZbzrfb5d/{z}/{x}/{y}.jpg', { attribution: 'Historical Maps Layer, from <a href="https://maps.nls.uk/projects/api/">NLS Maps</a>',
attribution: '<a href="https://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>', bounds: [[49.6, -12], [61.7, 3]],
bounds: [[49.6, -12], [61.7, 3]], minZoom:1, maxZoom:18,
minZoom:1, maxNativeZoom:19, maxZoom:20, subdomains: '0123'
subdomains: '0123' });
}); basemaps["UK OS 1919-47"] = NLS_OS_1919_1947;
basemaps["UK OS 1900"] = NLS_OS_1900;
//var CartoPos = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', { //var NLS_OS_1900 = L.tileLayer('https://nls-{s}.tileserver.com/NLS_API/{z}/{x}/{y}.jpg', {
// attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="https://cartodb.com/attributions">CartoDB</a>' var NLS_OS_1900 = L.tileLayer('https://nls-{s}.tileserver.com/fpsUZbzrfb5d/{z}/{x}/{y}.jpg', {
//}); attribution: '<a href="https://geo.nls.uk/maps/">National Library of Scotland Historic Maps</a>',
//basemaps["CartoDB Light"] = CartoPos; bounds: [[49.6, -12], [61.7, 3]],
minZoom:1, maxNativeZoom:19, maxZoom:20,
subdomains: '0123'
});
basemaps["UK OS 1900"] = NLS_OS_1900;
// Nice terrain based maps by Stamen Design //var CartoPos = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
var terrainUrl = "https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg"; // attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="https://cartodb.com/attributions">CartoDB</a>'
basemaps["Terrain"] = L.tileLayer(terrainUrl, { //});
subdomains: ['a','b','c','d'], //basemaps["CartoDB Light"] = CartoPos;
minZoom: 0,
maxZoom: 20,
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>'
});
// Nice watercolour based maps by Stamen Design // Nice terrain based maps by Stamen Design
var watercolorUrl = "https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg"; var terrainUrl = "https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg";
basemaps["Watercolor"] = L.tileLayer(watercolorUrl, { basemaps["Terrain"] = L.tileLayer(terrainUrl, {
subdomains: ['a','b','c','d'], subdomains: ['a','b','c','d'],
minZoom: 0, minZoom: 0,
maxZoom: 20, maxZoom: 20,
type: 'jpg', 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>' 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>'
}); });
// Nice watercolour based maps by Stamen Design
var watercolorUrl = "https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg";
basemaps["Watercolor"] = L.tileLayer(watercolorUrl, {
subdomains: ['a','b','c','d'],
minZoom: 0,
maxZoom: 20,
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 // Now add the overlays
@ -1047,41 +1050,43 @@ layers["_daynight"] = new L.LayerGroup();
overlays["day/night"] = layers["_daynight"]; overlays["day/night"] = layers["_daynight"];
// Add live rain data // Add live rain data
overlays["rainfall"] = new L.TileLayer('https://tilecache.rainviewer.com/v2/radar/' + parseInt(Date.now()/600000)*600 + '/256/{z}/{x}/{y}/2/1_1.png', { if (navigator.onLine) {
tileSize: 256, overlays["rainfall"] = new L.TileLayer('https://tilecache.rainviewer.com/v2/radar/' + parseInt(Date.now()/600000)*600 + '/256/{z}/{x}/{y}/2/1_1.png', {
opacity: 0.4, tileSize: 256,
transparent: true, opacity: 0.4,
attribution: '<a href="https://rainviewer.com" target="_blank">rainviewer.com</a>' transparent: true,
}); attribution: '<a href="https://rainviewer.com" target="_blank">rainviewer.com</a>'
});
// Add the buildings layer // Add the buildings layer
// overlays["buildings"] = new OSMBuildings(map).load(); // overlays["buildings"] = new OSMBuildings(map).load();
// map.removeLayer(overlays["buildings"]); // Hide it at start // map.removeLayer(overlays["buildings"]); // Hide it at start
// Add Roads // Add Roads
// overlays["roads"] = L.tileLayer('https://{s}.tile.openstreetmap.se/hydda/roads_and_labels/{z}/{x}/{y}.png', { // overlays["roads"] = L.tileLayer('https://{s}.tile.openstreetmap.se/hydda/roads_and_labels/{z}/{x}/{y}.png', {
// maxZoom: 18, // maxZoom: 18,
// 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>', // 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>',
// opacity: 0.8 // opacity: 0.8
// }); // });
// // Add Railways // // Add Railways
// overlays["railways"] = L.tileLayer('https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png', { // overlays["railways"] = L.tileLayer('https://{s}.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png', {
// maxZoom: 19, // maxZoom: 19,
// 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>)' // 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>)'
// }); // });
// // Add Public Transport (Buses) // // Add Public Transport (Buses)
// overlays["public transport"] = L.tileLayer('https://openptmap.org/tiles/{z}/{x}/{y}.png', { // overlays["public transport"] = L.tileLayer('https://openptmap.org/tiles/{z}/{x}/{y}.png', {
// maxZoom: 17, // maxZoom: 17,
// attribution: 'Map data: &copy; <a href="https://www.openptmap.org">OpenPtMap</a> contributors' // attribution: 'Map data: &copy; <a href="https://www.openptmap.org">OpenPtMap</a> contributors'
// }); // });
// Add the OpenSea markers layer // Add the OpenSea markers layer
overlays["ship nav"] = L.tileLayer('https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', { overlays["ship nav"] = L.tileLayer('https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', {
maxZoom: 19, maxZoom: 19,
attribution: 'Map data: &copy; <a href="https://www.openseamap.org">OpenSeaMap</a> contributors' attribution: 'Map data: &copy; <a href="https://www.openseamap.org">OpenSeaMap</a> contributors'
}); });
}
// Add the heatmap layer // 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'}}); 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. // Layer control based on select box rather than radio buttons.
//var layercontrol = L.control.selectLayers(basemaps, overlays).addTo(map); //var layercontrol = L.control.selectLayers(basemaps, overlays).addTo(map);