-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaflet.html
39 lines (38 loc) · 1.17 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hikes, Climbs and Ski Tours - Leaflet Version - lienhard.io</title>
<style>
body {
padding: 0;
margin: 0;
}
#map {
position: absolute;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
<script src="/leaflet/leaflet-providers.js"></script>
<script src="/leaflet/L.KML.js"></script>
<div id="map"></div>
<script>
let map = L.map("map").setView([46.84743, 8.18924], 8);
L.tileLayer.provider("OpenTopoMap", {}).addTo(map);
// Load kml.
fetch("/map.lienhard.io.kml")
.then(res => res.text())
.then(kmltext => {
const parser = new DOMParser();
const kml = parser.parseFromString(kmltext, 'text/xml');
const track = new L.KML(kml);
map.addLayer(track);
});
</script>
</body>
</html>