/
mapLayers.js
118 lines (113 loc) 路 3.48 KB
/
mapLayers.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
* @copyright Copyright (c) 2019, Paul Schw枚rer <hello@paulschwoerer.de>
*
* @author Paul Schw枚rer <hello@paulschwoerer.de>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
const attributionESRI = 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN...'
export const LayerTypes = {
Base: 'base',
Overlay: 'overlay',
}
export const LayerIds = {
OSM: 'osm',
RoadsOverlay: 'roads-overlay',
ESRI: 'esri',
ESRITopo: 'esri-topo',
OpenTopo: 'open-topo',
Watercolor: 'watercolor',
}
export const Layers = [
{
id: LayerIds.RoadsOverlay,
name: 'Roads Overlay',
type: LayerTypes.Overlay,
url: 'https://{s}.tile.openstreetmap.se/hydda/roads_and_labels/{z}/{x}/{y}.png',
attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN...',
options: {
id: 'Roads Overlay',
noWrap: false,
detectRetina: false,
maxZoom: 18,
},
opacity: 0.7,
},
{
id: LayerIds.OSM,
name: 'Street map',
type: LayerTypes.Base,
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
attribution: '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
options: {
id: 'Open Street Map',
noWrap: false,
detectRetina: false,
maxZoom: 19,
},
},
{
id: LayerIds.ESRI,
name: 'Satellite map',
type: LayerTypes.Base,
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
attribution: attributionESRI,
options: {
id: 'ESRI',
noWrap: false,
detectRetina: false,
maxZoom: 19,
},
},
{
id: LayerIds.ESRITopo,
name: 'Topographic',
type: LayerTypes.Base,
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}',
attribution: attributionESRI,
options: {
id: 'ESRI topo',
noWrap: false,
detectRetina: false,
maxZoom: 19,
},
},
{
id: LayerIds.Watercolor,
name: 'Watercolor',
type: LayerTypes.Base,
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.{ext}',
attribution: '<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a> | 漏 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>.',
options: {
id: 'Watercolor',
noWrap: false,
detectRetina: false,
maxZoom: 18,
ext: 'jpg',
subdomains: 'abcd',
},
},
]
export const baseLayersByName = {}
export const overlayLayersByName = {}
Layers.forEach((l) => {
if (l.type === LayerTypes.Base) {
baseLayersByName[l.options.id] = l
} else {
overlayLayersByName[l.options.id] = l
}
})