Add new map provider
This commit is contained in:
parent
8bb4d9d9dd
commit
7a57d252dd
1 changed files with 22 additions and 4 deletions
|
|
@ -1481,7 +1481,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConfigMapSelectedTileLayer() {
|
function getConfigMapSelectedTileLayer() {
|
||||||
return localStorage.getItem("config_map_selected_tile_layer") || "OpenStreetMap";
|
return localStorage.getItem("config_map_selected_tile_layer") || "Thunderforest Neighbourhood";
|
||||||
}
|
}
|
||||||
|
|
||||||
function setConfigMapSelectedTileLayer(layer) {
|
function setConfigMapSelectedTileLayer(layer) {
|
||||||
|
|
@ -2632,6 +2632,21 @@
|
||||||
// remove leaflet link
|
// remove leaflet link
|
||||||
map.attributionControl.setPrefix('');
|
map.attributionControl.setPrefix('');
|
||||||
|
|
||||||
|
var openThunderforestLandscapeMapTileLayer = L.tileLayer('https://tiles.nixware.dev/landscape/{z}/{x}/{y}.png', {
|
||||||
|
maxZoom: 22,
|
||||||
|
attribution: 'Tiles © <a href="https://www.thunderforest.com/contact/">Gravitystorm Limited | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>',
|
||||||
|
});
|
||||||
|
|
||||||
|
var openThunderforestAtlasMapTileLayer = L.tileLayer('https://tiles.nixware.dev/atlas/{z}/{x}/{y}.png', {
|
||||||
|
maxZoom: 22,
|
||||||
|
attribution: 'Tiles © <a href="https://www.thunderforest.com/contact/">Gravitystorm Limited | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>',
|
||||||
|
});
|
||||||
|
|
||||||
|
var openThunderforestNeighbourhoodMapTileLayer = L.tileLayer('https://tiles.nixware.dev/neighbourhood/{z}/{x}/{y}.png', {
|
||||||
|
maxZoom: 22,
|
||||||
|
attribution: 'Tiles © <a href="https://www.thunderforest.com/contact/">Gravitystorm Limited | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>',
|
||||||
|
});
|
||||||
|
|
||||||
var openStreetMapTileLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
var openStreetMapTileLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 22, // increase from 18 to 22
|
maxZoom: 22, // increase from 18 to 22
|
||||||
attribution: 'Tiles © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>',
|
attribution: 'Tiles © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>',
|
||||||
|
|
@ -2639,7 +2654,7 @@
|
||||||
|
|
||||||
var openTopoMapTileLayer = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
|
var openTopoMapTileLayer = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 17, // open topo map doesn't have tiles closer than this
|
maxZoom: 17, // open topo map doesn't have tiles closer than this
|
||||||
attribution: 'Tiles © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
attribution: 'Tiles © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>',
|
||||||
});
|
});
|
||||||
|
|
||||||
var esriWorldImageryTileLayer = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
var esriWorldImageryTileLayer = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
||||||
|
|
@ -2659,7 +2674,10 @@
|
||||||
attribution: 'Tiles © Google | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>'
|
attribution: 'Tiles © Google | Data from <a target="_blank" href="https://meshtastic.org/docs/software/integrations/mqtt/">Meshtastic</a>'
|
||||||
});
|
});
|
||||||
|
|
||||||
var tileLayers = {
|
var tileLayers = {
|
||||||
|
"Thunderforest Neighbourhood": openThunderforestNeighbourhoodMapTileLayer,
|
||||||
|
"Thunderforest Landscape": openThunderforestLandscapeMapTileLayer,
|
||||||
|
"Thunderforest Atlas": openThunderforestAtlasMapTileLayer,
|
||||||
"OpenStreetMap": openStreetMapTileLayer,
|
"OpenStreetMap": openStreetMapTileLayer,
|
||||||
"OpenTopoMap": openTopoMapTileLayer,
|
"OpenTopoMap": openTopoMapTileLayer,
|
||||||
"Esri Satellite": esriWorldImageryTileLayer,
|
"Esri Satellite": esriWorldImageryTileLayer,
|
||||||
|
|
@ -2669,7 +2687,7 @@
|
||||||
|
|
||||||
// use tile layer based on config
|
// use tile layer based on config
|
||||||
const selectedTileLayerName = getConfigMapSelectedTileLayer();
|
const selectedTileLayerName = getConfigMapSelectedTileLayer();
|
||||||
const selectedTileLayer = tileLayers[selectedTileLayerName] || openStreetMapTileLayer;
|
const selectedTileLayer = tileLayers[selectedTileLayerName] || openThunderforestNeighbourhoodMapTileLayer;
|
||||||
selectedTileLayer.addTo(map);
|
selectedTileLayer.addTo(map);
|
||||||
|
|
||||||
// create layer groups
|
// create layer groups
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue