-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaflet.html
43 lines (38 loc) · 1.23 KB
/
leaflet.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
<html>
<head>
<title>Mapping my runs</title>
<link rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
</head>
<body>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<script type="text/javascript"
src="https://rawgit.com/jieter/Leaflet.encoded/master/Polyline.encoded.js"></script>
<div id="map" style="height: 500px"></div>
<script>
var map = L.map("map").setView([50.73140, 3.07874], 11);
L.tileLayer(
"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 18,
attribution: "© <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>"
}).addTo(map);
var encodedRoutes = {{ runs|safe }};
for (let encoded of encodedRoutes) {
var coordinates = L.Polyline.fromEncoded(encoded).getLatLngs();
L.polyline(
coordinates,
{
color: "blue",
weight: 2,
opacity: .7,
lineJoin: "round"
}
).addTo(map);
}
</script>
</body>
</html>