mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
support OpenStreetMap(Humanitarian), OpenTopoMap, OPNVKarte, CyclOSM
This commit is contained in:
+36
-1
@@ -2,7 +2,42 @@ const leafletTileSources = {
|
||||
'openstreetmap': {
|
||||
tileUrlFormat: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
tileUrlSubDomains: 'abc',
|
||||
attribution : '© <a href="http://www.openstreetmap.org/copyright" class="external" target="_blank">OpenStreetMap</a>'
|
||||
minZoom: 1,
|
||||
maxZoom: 19,
|
||||
defaultZoomLevel: 14,
|
||||
attribution : '© <a href="https://www.openstreetmap.org/copyright" class="external" target="_blank">OpenStreetMap</a> contributors'
|
||||
},
|
||||
'openstreetmap-humanitarian': {
|
||||
tileUrlFormat: 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
|
||||
tileUrlSubDomains: 'abc',
|
||||
minZoom: 1,
|
||||
maxZoom: 19,
|
||||
defaultZoomLevel: 14,
|
||||
attribution : '© <a href="https://www.openstreetmap.org/copyright" class="external" target="_blank">OpenStreetMap</a> contributors, Tiles style by <a href="https://www.hotosm.org/" class="external" target="_blank">Humanitarian OpenStreetMap Team</a> hosted by <a href="https://openstreetmap.fr/" class="external" target="_blank">OpenStreetMap France</a>'
|
||||
},
|
||||
'opentopomap': {
|
||||
tileUrlFormat: 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
|
||||
tileUrlSubDomains: 'abc',
|
||||
minZoom: 1,
|
||||
maxZoom: 17,
|
||||
defaultZoomLevel: 14,
|
||||
attribution : 'Map data: © <a href="https://www.openstreetmap.org/copyright" class="external" target="_blank">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org" class="external" target="_blank">SRTM</a> | Map style: © <a href="https://opentopomap.org" class="external" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" class="external" target="_blank">CC-BY-SA</a>)'
|
||||
},
|
||||
'opnvkarte': {
|
||||
tileUrlFormat: 'https://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png',
|
||||
tileUrlSubDomains: '',
|
||||
minZoom: 1,
|
||||
maxZoom: 17,
|
||||
defaultZoomLevel: 14,
|
||||
attribution : 'Map <a href="https://memomaps.de/" class="external" target="_blank">memomaps.de</a> <a href="http://creativecommons.org/licenses/by-sa/2.0/" class="external" target="_blank">CC-BY-SA</a>, map data © <a href="https://www.openstreetmap.org/copyright" class="external" target="_blank">OpenStreetMap</a> contributors'
|
||||
},
|
||||
'cyclosm': {
|
||||
tileUrlFormat: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png',
|
||||
tileUrlSubDomains: 'abc',
|
||||
minZoom: 1,
|
||||
maxZoom: 19,
|
||||
defaultZoomLevel: 14,
|
||||
attribution : '<a href="https://github.com/cyclosm/cyclosm-cartocss-style/releases" title="CyclOSM - Open Bicycle render" class="external" target="_blank">CyclOSM</a> | Map data: © <a href="https://www.openstreetmap.org/copyright" class="external" target="_blank">OpenStreetMap</a> contributors'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,18 @@ export function loadLeafletMapAssets() {
|
||||
}
|
||||
|
||||
export function createLeafletMapHolder(mapProvider) {
|
||||
const mapTileSource = mapConstants.leafletTileSources[mapProvider];
|
||||
|
||||
if (!mapTileSource) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
mapProvider: mapProvider,
|
||||
dependencyLoaded: !!leafletHolder.leaflet,
|
||||
inited: false,
|
||||
defaultZoomLevel: 14,
|
||||
minZoomLevel: 1,
|
||||
defaultZoomLevel: mapTileSource.defaultZoomLevel,
|
||||
minZoomLevel: mapTileSource.minZoom,
|
||||
leafletInstance: null,
|
||||
leafletTileLayer: null,
|
||||
leafletZoomControl: null,
|
||||
@@ -52,7 +58,7 @@ export function createLeafletMapInstance(mapHolder, mapContainer, options) {
|
||||
|
||||
const tileLayer = leaflet.tileLayer(mapTileSource.tileUrlFormat, {
|
||||
subdomains: mapTileSource.tileUrlSubDomains,
|
||||
maxZoom: 19
|
||||
maxZoom: mapTileSource.maxZoom
|
||||
});
|
||||
tileLayer.addTo(leafletInstance);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user