-
Notifications
You must be signed in to change notification settings - Fork 5
/
example.mapbox.html
75 lines (70 loc) · 2.68 KB
/
example.mapbox.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Mapbox GL Basemaps Control</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
<link href="https://api.mapbox.com/mapbox-gl-js/v2.6.0/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v2.6.0/mapbox-gl.js"></script>
<link href="lib/basemaps.css" rel="stylesheet">
<script src="lib/index.js"></script>
<style>
html, body, #Map {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
</style>
<script>
window.addEventListener("load", function() {
mapboxgl.accessToken = "<replace-with-your-token>";
const map = new mapboxgl.Map({
container: "Map",
attributionControl: false,
style: {
version: 8,
sources: {},
layers: []
}
});
map.addControl(new mapboxgl.AttributionControl({ compact: true }), "bottom-right");
map.addControl(
new MaplibreGLBasemapsControl(
{
basemaps: [
{
id: "basemap_World_Topo_Map",
tiles: ["//server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}"],
tileSize: 256,
attribution: "Sources: Esri, HERE, Garmin, Intermap, increment P Corp., GEBCO, USGS, FAO, NPS, NRCAN, GeoBase, IGN, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), (c) OpenStreetMap contributors, and the GIS User Community",
minzoom: 0,
maxzoom: 22
},
{
id: "stamen",
tiles: [
"//stamen-tiles-a.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",
"//stamen-tiles-b.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",
"//stamen-tiles-c.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",
"//stamen-tiles-d.a.ssl.fastly.net/toner/{z}/{x}/{y}.png"
],
tileSize: 256,
attribution: "Map tiles by <a href='http://stamen.com'>Stamen Design</a>, <a href='http://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a> — Map data © <a href='http://openstreetmap.org'>OpenStreetMap</a> contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/''>CC-BY-SA</a>",
minzoom: 0,
maxzoom: 20
}
],
initialBasemap: "stamen",
expandDirection: "top"
}),
"bottom-left"
);
});
</script>
</head>
<body>
<div id="Map"></div>
</body>
</html>