-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.html
80 lines (70 loc) · 1.92 KB
/
index.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>
<head>
<meta charset='utf-8' />
<title>国土地理院最適化ベクトルタイル</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='./lib/[email protected]/maplibre-gl.js'></script>
<link href='./lib/[email protected]/maplibre-gl.css' rel='stylesheet' />
<script src='./lib/[email protected]/index.js'></script>
<style>
body { margin:0; padding:0; }
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
#map canvas {
cursor: crosshair;
}
#menu {
position: absolute;
top:0%;
right:0%;
background: #3e3e3ec7;
color: #ffffff;
padding: 10px;
font-family: 'Open Sans', sans-serif;
}
#menu ul{
list-style:none;
padding:0;
margin:0;
}
</style>
</head>
<body>
<div id='map'></div>
<div id="menu">
<ul>
<li><input id="style" type="checkbox" value="std"><label for="std">サンプルスタイル(標準地図風)適用</label></li>
<li><input id="bdr" type="checkbox" value="bdr"><label for="bdr">タイル境界表示</label></li>
</ul>
</div>
<script>
let protocol = new pmtiles.Protocol();
maplibregl.addProtocol("pmtiles",protocol.tile);
var map = new maplibregl.Map({
container: 'map',
hash: true,
style: './style/skeleton.json',
center: [139.767144, 35.680621],
zoom: 15,
maxZoom: 17.99,
minZoom: 4,
localIdeographFontFamily: false
// localIdeographFontFamily: ['MS Gothic', 'Hiragino Kaku Gothic Pro', 'sans-serif']
});
map.addControl(new maplibregl.NavigationControl(), 'bottom-right');
let check1 = document.getElementById('style');
let check2 = document.getElementById('bdr');
document.getElementById('style').addEventListener('click', () => {
check1.checked ? map.setStyle('./style/std.json') : map.setStyle('./style/skeleton.json');
});
document.getElementById('bdr').addEventListener('click', () => {
check2.checked ? map.showTileBoundaries = true : map.showTileBoundaries = false;
});
</script>
</body>
</html>