-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
78 lines (71 loc) · 1.83 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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Deploy Preview - Geolonia Basic GSI Seamlessphoto Style</title>
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-color: #555555;
}
.left {
margin-right: 400px;
height: 100%;
background-color: #FFFFFF;
}
.right
{
margin-left: calc(100% - 400px);
position: absolute;
top: 0;
padding: 8px 16px;
height: calc(100% - 48px);
width: calc(400px - 32px);
overflow: scroll;
color: #FFFFFF;
}
</style>
</head>
<body>
<div
id="map"
class="left"
data-lng="139.7673068"
data-lat="35.6809591"
data-zoom="14"
data-hash="on"
data-marker="off"
></div>
<pre id="json" class="right"></pre>
<script src="https://cdn.geolonia.com/v1/embed?geolonia-api-key=YOUR-API-KEY"></script>
<script>
const map = new geolonia.Map({
container: "#map",
style: "./style.json",
});
map.on('load', () => {
const dumpFeature = event => {
const features = map.queryRenderedFeatures(event.point)
const jsonContainer = document.getElementById('json')
jsonContainer.innerText = JSON.stringify(features, null, ' ')
}
const mouseEnter = () => {
map.getCanvas().style.cursor = 'pointer'
}
const mouseLeave = () => {
map.getCanvas().style.cursor = ''
}
map.getStyle().layers.forEach( (item) => {
map.on('click', item.id, dumpFeature)
map.on('mouseenter', item.id, mouseEnter)
map.on('mouseleave', item.id, mouseLeave)
})
})
</script>
</body>
</html>