-
Notifications
You must be signed in to change notification settings - Fork 150
/
map4.html
63 lines (49 loc) · 1.98 KB
/
map4.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
<!DOCTYPE html><html lang="ja"><head><meta charset="utf-8"/>
<title>マップアプリ4</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 src="sparql.js"></script>
<script>"use strict"
window.onload = function() {
var map = initMap('mapid')
map.setZoom(16)
map.panTo([ 35.943560,136.188917 ]) // 鯖江駅
map.addIcon(35.944571, 136.186228 , "Hana道場", "icon/hanadojo.png", 64)
// SPARQLクエリー
var query = `
prefix ic: <http://imi.go.jp/ns/core/rdf#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
select ?uri ?name ?lat ?lng {
?uri ic:名称 [ ic:表記 ?name ].
?uri ic:地理座標 [ ic:緯度 ?lat; ic:経度 ?lng; ].
filter(contains(str(?name),'駐車場'))
} limit 100
`
querySPARQL(query, function(data) {
var items = data.results.bindings
for (var i = 0; i < items.length; i++) {
var item = items[i]
var lat = item.lat.value
var lng = item.lng.value
var name = item.name.value
map.addIcon(lat, lng, name, "icon/carparking.png", 40)
}
})
}
</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>駐車場マップ - egmapjs</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>