-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexample.html
80 lines (72 loc) · 2.11 KB
/
example.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
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>MapLibre GL Basemaps Control</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
<link href="https://unpkg.com/[email protected]/dist/maplibre-gl.css" rel="stylesheet" />
<script src="https://unpkg.com/[email protected]/dist/maplibre-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 () {
const map = new maplibregl.Map({
container: "Map",
attributionControl: false,
style: {
version: 8,
sources: {},
layers: []
}
});
map.addControl(new maplibregl.AttributionControl({ compact: true }), "bottom-right");
map.addControl(
new MaplibreGLBasemapsControl(
{
basemaps: [
{
id: "ortoEsri",
tiles: ["https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"],
sourceExtraParams: {
tileSize: 256,
attribution: "ESRI © <a href='http://www.esri.com'>ESRI</a>",
minzoom: 0,
maxzoom: 22
}
},
{
id: "OpenStreetMap",
tiles: [
'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
],
sourceExtraParams: {
tileSize: 256,
attribution: "© OpenStreetMap Contributors",
minzoom: 0,
maxzoom: 20
}
}
],
initialBasemap: "OpenStreetMap",
expandDirection: "top"
}),
"bottom-left"
);
});
</script>
</head>
<body>
<div id="Map"></div>
</body>
</html>