kopia lustrzana https://github.com/FacilMap/facilmap
Provide a proper way to change the default layers
rodzic
73fc9cd22d
commit
5c739f66e4
|
@ -24,99 +24,107 @@ export interface Layers {
|
|||
overlays: Record<string, Layer>;
|
||||
}
|
||||
|
||||
export let createLayers = (): Layers & { fallbackLayer: string | undefined } => ({
|
||||
baseLayers: {
|
||||
Mpnk: L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
||||
fmName: "Mapnik",
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
}),
|
||||
export function createDefaultLayers(): Layers & { fallbackLayer: string | undefined } {
|
||||
return {
|
||||
baseLayers: {
|
||||
Mpnk: L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
||||
fmName: "Mapnik",
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
/*MSfR: L.tileLayer('https://maps.heigit.org/openmapsurfer/tiles/roads/webmercator/{z}/{x}/{y}.png', {
|
||||
fmName: "MapSurfer Road",
|
||||
attribution: '© <a href="https://openrouteservice.org/" target="_blank">OpenRouteService</a> / <a href="http://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
})*/
|
||||
/*MSfR: L.tileLayer('https://maps.heigit.org/openmapsurfer/tiles/roads/webmercator/{z}/{x}/{y}.png', {
|
||||
fmName: "MapSurfer Road",
|
||||
attribution: '© <a href="https://openrouteservice.org/" target="_blank">OpenRouteService</a> / <a href="http://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
})*/
|
||||
|
||||
ToPl: L.tileLayer("https://sg.geodatenzentrum.de/wmts_topplus_web_open/tile/1.0.0/web/default/WEBMERCATOR/{z}/{y}/{x}.png", {
|
||||
fmName: "TopPlus",
|
||||
attribution: '© <a href="https://www.bkg.bund.de/">Bundesamt für Kartographie und Geodäsie</a> ' + (new Date()).getFullYear(),
|
||||
noWrap: true
|
||||
}),
|
||||
ToPl: L.tileLayer("https://sg.geodatenzentrum.de/wmts_topplus_web_open/tile/1.0.0/web/default/WEBMERCATOR/{z}/{y}/{x}.png", {
|
||||
fmName: "TopPlus",
|
||||
attribution: '© <a href="https://www.bkg.bund.de/">Bundesamt für Kartographie und Geodäsie</a> ' + (new Date()).getFullYear(),
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
Map1: L.tileLayer("http://beta.map1.eu/tiles/{z}/{x}/{y}.jpg", {
|
||||
fmName: "Map1.eu",
|
||||
attribution: '© <a href="http://map1.eu/" target="_blank">Map1.eu</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
}),
|
||||
Map1: L.tileLayer("http://beta.map1.eu/tiles/{z}/{x}/{y}.jpg", {
|
||||
fmName: "Map1.eu",
|
||||
attribution: '© <a href="http://map1.eu/" target="_blank">Map1.eu</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
Topo: L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
|
||||
fmName: "OpenTopoMap",
|
||||
attribution: '© <a href="https://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
}),
|
||||
Topo: L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
|
||||
fmName: "OpenTopoMap",
|
||||
attribution: '© <a href="https://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
OCyc: L.tileLayer("https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=bc74ceb5f91c448b9615f9b576c61c16", {
|
||||
fmName: "OpenCycleMap",
|
||||
attribution: '© <a href="https://opencyclemap.org/" target="_blank">OpenCycleMap</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
}),
|
||||
OCyc: L.tileLayer("https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=bc74ceb5f91c448b9615f9b576c61c16", {
|
||||
fmName: "OpenCycleMap",
|
||||
attribution: '© <a href="https://opencyclemap.org/" target="_blank">OpenCycleMap</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
HiBi: L.tileLayer("https://tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png", {
|
||||
fmName: "Hike & Bike Map",
|
||||
attribution: '© <a href="http://hikebikemap.org/" target="_blank">Hike & Bike Map</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
}),
|
||||
HiBi: L.tileLayer("https://tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png", {
|
||||
fmName: "Hike & Bike Map",
|
||||
attribution: '© <a href="http://hikebikemap.org/" target="_blank">Hike & Bike Map</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
MpnW: L.tileLayer("http://ftdl.de/tile-cache/tiles/{z}/{x}/{y}.png", {
|
||||
fmName: "Mapnik Water",
|
||||
attribution: '© <a href="https://www.freietonne.de/" target="_blank">FreieTonne</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
})
|
||||
},
|
||||
overlays: {
|
||||
OPTM: L.tileLayer("http://openptmap.org/tiles/{z}/{x}/{y}.png", {
|
||||
fmName: "Public transportation",
|
||||
attribution: '© <a href="http://openptmap.org/" target="_blank">OpenPTMap</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
}),
|
||||
MpnW: L.tileLayer("http://ftdl.de/tile-cache/tiles/{z}/{x}/{y}.png", {
|
||||
fmName: "Mapnik Water",
|
||||
attribution: '© <a href="https://www.freietonne.de/" target="_blank">FreieTonne</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
noWrap: true
|
||||
})
|
||||
},
|
||||
overlays: {
|
||||
OPTM: L.tileLayer("http://openptmap.org/tiles/{z}/{x}/{y}.png", {
|
||||
fmName: "Public transportation",
|
||||
attribution: '© <a href="http://openptmap.org/" target="_blank">OpenPTMap</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
Hike: L.tileLayer("https://tile.waymarkedtrails.org/hiking/{z}/{x}/{y}.png", {
|
||||
fmName: "Hiking paths",
|
||||
attribution: '© <a href="https://hiking.waymarkedtrails.org/" target="_blank">Waymarked Trails</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
}),
|
||||
Hike: L.tileLayer("https://tile.waymarkedtrails.org/hiking/{z}/{x}/{y}.png", {
|
||||
fmName: "Hiking paths",
|
||||
attribution: '© <a href="https://hiking.waymarkedtrails.org/" target="_blank">Waymarked Trails</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
Bike: L.tileLayer("https://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png", {
|
||||
fmName: "Bicycle routes",
|
||||
attribution: '© <a href="https://cycling.waymarkedtrails.org/" target="_blank">Waymarked Trails</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
}),
|
||||
Bike: L.tileLayer("https://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png", {
|
||||
fmName: "Bicycle routes",
|
||||
attribution: '© <a href="https://cycling.waymarkedtrails.org/" target="_blank">Waymarked Trails</a> / <a href="https://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>',
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
Rlie: L.tileLayer("https://tiles.wmflabs.org/hillshading/{z}/{x}/{y}.png", {
|
||||
maxZoom: 16,
|
||||
fmName: "Relief",
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
}),
|
||||
Rlie: L.tileLayer("https://tiles.wmflabs.org/hillshading/{z}/{x}/{y}.png", {
|
||||
maxZoom: 16,
|
||||
fmName: "Relief",
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
grid: new AutoGraticule({
|
||||
fmName: "Graticule",
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
}),
|
||||
grid: new AutoGraticule({
|
||||
fmName: "Graticule",
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
}),
|
||||
|
||||
FrTo: new FreieTonne({
|
||||
fmName: "Sea marks",
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
})
|
||||
},
|
||||
fallbackLayer: 'Mpnk'
|
||||
});
|
||||
FrTo: new FreieTonne({
|
||||
fmName: "Sea marks",
|
||||
zIndex: 300,
|
||||
noWrap: true
|
||||
})
|
||||
},
|
||||
fallbackLayer: 'Mpnk'
|
||||
};
|
||||
};
|
||||
|
||||
let createLayers = createDefaultLayers;
|
||||
|
||||
export function setLayers(create: typeof createDefaultLayers): void {
|
||||
createLayers = create;
|
||||
}
|
||||
|
||||
export function getLayers(map: Map): Layers {
|
||||
if (!map._fmLayers) {
|
||||
|
|
Ładowanie…
Reference in New Issue