-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.html
90 lines (85 loc) · 2.47 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
81
82
83
84
85
86
87
88
89
90
<html>
<head>
<meta charset="utf-8">
<title>OverpassFrontend example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="node_modules/leaflet/dist/leaflet.css" />
<link rel="stylesheet" href="demo/demo.css" />
<script src="node_modules/leaflet/dist/leaflet.js"></script>
<script src="node_modules/leaflet-polylineoffset/leaflet.polylineoffset.js"></script>
<script src="node_modules/leaflet-textpath/leaflet.textpath.js"></script>
<script src="node_modules/leaflet-polylinedecorator/dist/leaflet.polylineDecorator.js"></script>
<script src="dist/overpass-layer.js"></script>
<script type='text/javascript'>
var map
var overpassFrontend
var demos = {
trees: {
title: "Trees"
},
parks: {
title: "Parks"
},
gastro: {
title: "Restaurants and Cafēs"
},
cycle_routes: {
title: "Bicycle route network"
},
roads1: {
title: "Roads with casing"
},
roads2: {
title: "Roads colored by level"
},
pt: {
title: "Public transport network"
},
tracks: {
title: "Rails with offset by gauge"
}
}
var overpassURL = '//overpass-api.de/api/interpreter'
// var overpassURL = 'map.osm' // Download a .osm file to this directory and use this instead
var mapCenter = [ 51.503, -0.093 ]
window.onload = function() {
map = L.map('map').setView(mapCenter, 17)
overpassFrontend = new OverpassFrontend(overpassURL, {
timeGap: 10,
effortPerRequest: 100
})
var osm_mapnik = L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}
)
osm_mapnik.addTo(map)
if (!location.search) {
document.body.classList.add('hasInfo')
map.invalidateSize()
document.getElementById('info').appendChild(document.createTextNode('Demos:'))
var ul = document.createElement('ul')
document.getElementById('info').appendChild(ul)
for (var i in demos) {
var li = document.createElement('li')
li.innerHTML = '<a href="?' + i + '">' + (demos[i].title || i) + '</a>'
ul.appendChild(li)
}
} else {
var script = document.createElement('script')
script.src = 'demo/' + location.search.substr(1) + '.js'
document.body.appendChild(script)
script.onload = () => {
map.invalidateSize()
}
}
}
</script>
</head>
<body>
<div id='map'></div>
<div id='info'></div>
<div id='loadingIndicator'>LOADING</div>
</body>
</html>