-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
77 lines (67 loc) · 2.19 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
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>osmzen example</title>
<style>
body {
margin: 0;
border: 0;
padding: 0;
}
#map {
height: 100%;
width: 100%;
position: absolute;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
let map = L.map('map', {
minZoom: 15,
maxZoom: 18,
});
if (window.location.hash) {
let parts = window.location.hash.substring(1).split('/');
map.setView([parts[2], parts[1]], parts[0]);
} else {
map.setView([37.82502, -122.25466], 17);
}
map.on('move', _.throttle(() => {
window.location.hash = [
map.getZoom().toFixed(2),
map.getCenter().lng.toFixed(4),
map.getCenter().lat.toFixed(4)
].join('/')
}, 500))
let tangramLayer = Tangram.leafletLayer({
attribution: '<a href="https://github.com/tangrams" target="_blank">Tangram</a> | <a href="http://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>',
scene: {
import: [
'https://tangrams.github.io/bubble-wrap/bubble-wrap-style.yaml',
'https://tangrams.github.io/bubble-wrap/themes/label-10.yaml'
],
sources: {
mapzen: {
type: 'GeoJSON',
url: window.location.origin + '/tiles/{z}/{x}/{y}.json',
tile_size: 256,
min_zoom: 15,
max_zoom: 18,
min_display_zoom: 15,
max_display_zoom: 18
}
}
}
});
tangramLayer.addTo(map);
</script>
</body>
</html>