-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathmap2.html
62 lines (47 loc) · 2.02 KB
/
map2.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
<!DOCTYPE html><html lang="ja"><head><meta charset="utf-8"/>
<meta name="viewport" content="width=device-width"/>
<title>マップアプリ2</title>
<link rel="apple-touch-icon" href="app-icon.png"/>
<meta property="og:image" content="ogp-image.jpg"/>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://code4fukui.github.io/egmapjs/egmap.js"></script>
<link rel="stylesheet" href="https://code4fukui.github.io/egmapjs/egmap.css"/>
<script src="https://fukuno.jig.jp/fukuno.js"></script>
<script src="https://code4fukui.github.io/egmapjs/sparql.js"></script>
<script>"use strict"
window.onload = function() {
var map = initMap('mapid')
map.setZoom(16)
map.panTo([ 35.943560,136.188917 ]) // 鯖江駅
// スラッシュ2つ続けると「コメント」になる、後ろの行は何を書いてもプログラムに影響なし
// ピンを追加
map.addIcon(35.943560,136.188917, "鯖江駅")
// アイコンを追加
map.addIcon(35.944571, 136.186228 , "Hana道場", "icon/hanadojo.png", 64)
// タップしたところの緯度経度を表示
map.on("click", (e) => alert(e.latlng))
// 線分を地図上に表示する
map.addLayer(L.polyline([
[ 35.94, 136.18 ],
[ 35.95, 136.19 ],
[ 35.94, 136.20 ]
], { color: 'red' }))
// 領域を地図上に表示する
map.addLayer(L.polygon([
[ 35.941, 136.189 ],
[ 35.942, 136.190 ],
[ 35.941, 136.191 ]
], { color: 'green' }))
}
</script>
<style>
body { margin: 0; font-family: sans-serif; text-align: center; }
h1 { font-size: 5vw; margin: 0; }
#mapid { height: 60vh; }
</style></head><body>
<h1>マップアプリ2</h1>
<div id="mapid"></div>
<img id=qrcode><script>addEventListener("load", () => qrcode.src = "https://chart.apis.google.com/chart?chs=140x140&cht=qr&chl=" + encodeURIComponent(document.location))</script><br>
<a href=https://fukuno.jig.jp/2393>簡単地図アプリ egmapjs チュートリアル</a>
</body></html>