-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayers.ts
39 lines (36 loc) · 1.27 KB
/
layers.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import {
Control,
tileLayer,
} from "leaflet";
import {
IRawNamedTileLayers,
} from "./types";
const rawLayers: IRawNamedTileLayers = Object.freeze({
carto_dark: [
"CartoDB dark",
"http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",
"© <a href=http://www.openstreetmap.org/copyright>OpenStreetMap</a> \
contributors © <a href=https://carto.com/attributions>CARTO</a>",
],
osm: [
"Open Street Map",
"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
"Map data © <a href=http://www.openstreetmap.org/copyright>OpenStreetMap</a> contributors",
],
stamen_toner: [
"Stamen Watercolor",
"https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png",
"Map tiles by <a href=http://stamen.com>Stamen Design</a>, under \
<a href=http://creativecommons.org/licenses/by/3.0>CC BY 3.0</a>. Data \
by <a href=http://openstreetmap.org>OpenStreetMap</a>, under \
<a href=http://www.openstreetmap.org/copyright>ODbL</a>.",
],
});
export const namedTileLayers: Control.LayersObject = Object.keys(rawLayers)
.reduce((memo: Control.LayersObject, key) => {
const [name, urlTemplate, attribution] = rawLayers[key];
memo[name] = tileLayer(urlTemplate, {
attribution,
});
return memo;
}, {});