-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.html
118 lines (93 loc) · 3.46 KB
/
template.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html>
<head>
<title>QGIS Track Profile 2 Web</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style>
html,
body,
#map,
#elevation-div {
height: 100%;
width: 100%;
padding: 0px;
margin: 0px;
position: relative;
z-index: 9999;
}
#elevation-div { overflow: visible; }
#map {
height: 75%;
position: relative;
z-index: 1;
}
#elevation-div {
height: 25%;
font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
}
.data-summary {
font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
position: absolute;
bottom: 0;
left: 45px;
}
.data-summary .summaryvalue {
font-weight: bold;
}
</style>
<style>
.custom-theme.leaflet-control.elevation .area {
fill: { area_fill_color };
stroke: hsla(60, 0%, 0%, 0.85);
stroke-width: { area_stroke_width };
}
.custom-theme.height-focus.circle-lower {
fill: { marker_color };
}
.custom-theme.elevation-polyline {
stroke: { line_color };
stroke-opacity: { line_opacity } ;
}
</style>
<!-- Leaflet (JS/CSS) -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<!-- D3.js -->
<script src="https://unpkg.com/[email protected]/build/d3.min.js" charset="utf-8"></script>
<!-- leaflet-gpx -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-gpx/1.4.0/gpx.js"></script>
<!-- leaflet-elevation -->
<link rel="stylesheet" href="https://unpkg.com/@raruto/[email protected]/leaflet-elevation.min.css" />
<script src="https://unpkg.com/@raruto/[email protected]/leaflet-elevation.min.js"></script>
</head>
<body>
<div id="map"></div>
<div id="elevation-div" class="leaflet-control elevation"></div>
<div id="data-summary" class="data-summary"><span class="totlen"><span class="summarylabel">Total Length: </span><span class="summaryvalue">0</span></span> — <span class="maxele"><span class="summarylabel">Max Elevation: </span><span class="summaryvalue">0</span></span>
— <span class="minele"><span class="summarylabel">Min Elevation: </span><span class="summaryvalue">0</span></span></div>
<script>
var opts = '{ py_opts }';
var map = new L.Map('map', opts.map);
var baseLayers = {};
baseLayers.OTM = new L.TileLayer(opts.otmLayer.url, opts.otmLayer.options);
var controlZoom = new L.Control.Zoom(opts.zoomControl);
var controlElevation = L.control.elevation(opts.elevationControl.options);
var controlLayer = L.control.layers(baseLayers, null, opts.layersControl.options);
controlZoom.addTo(map);
controlLayer.addTo(map);
map.addLayer(baseLayers.OTM);
map.on('eledata_loaded', function(e) {
var q = document.querySelector.bind(document);
var track = e.track_info;
controlLayer.addOverlay(e.layer, e.name);
q('.totlen .summaryvalue').innerHTML = track.distance.toFixed(2) + " km";
q('.maxele .summaryvalue').innerHTML = track.elevation_max.toFixed(2) + " m";
q('.minele .summaryvalue').innerHTML = track.elevation_min.toFixed(2) + " m";
});
controlElevation.loadChart(map);
controlElevation.loadData(opts.elevationControl.data);
</script>
</body>
</html>