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
|
% if ($origin and $destination) {
%= include '_map_infobox'
% }
<div class="container">
<div id="map" style="height: 500px;">
</div>
</div>
<script>
var map = L.map('map').setView([51.306, 9.712], 6);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var stations = [
% for my $station ( @{stash('station_coordinates') // [] } ) {
[[<%= $station->[0][0] %>,<%= $station->[0][1] %>],['<%== join("','", map { Mojo::Util::xml_escape($_) } @{$station->[1]}) %>']],
% }
];
var routes = [];
var pl;
% for my $line_group ( @{ stash('polyline_groups') // [] } ) {
routes = [
% for my $pair ( @{$line_group->{polylines} // []} ) {
[[<%= $pair->[0][0] %>,<%= $pair->[0][1] %>],[<%= $pair->[1][0] %>,<%= $pair->[1][1] %>]],
% }
];
pl = L.polyline(routes, {color: '<%= $line_group->{color} %>', opacity: <%= $line_group->{opacity} %>}).addTo(map);
% if ($line_group->{fit_bounds}) {
if (routes.length) {
map.fitBounds(pl.getBounds());
}
% }
% }
for (var station_id in stations) {
L.circle(stations[station_id][0], {
color: '#f03',
opacity: 0.7,
fillColor: '#f03',
fillOpacity: 0.5,
radius: 250
}).bindPopup(stations[station_id][1].join('<br/>')).addTo(map);
}
var greenIcon = new L.Icon({
iconUrl: '/static/leaflet/images/marker-icon-2x-green.png',
shadowUrl: '/static/leaflet/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
var goldIcon = new L.Icon({
iconUrl: '/static/leaflet/images/marker-icon-2x-gold.png',
shadowUrl: '/static/leaflet/images/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
var marker;
% for my $marker (@{stash('markers') // [] } ) {
% if ($marker->{icon}) {
marker = L.marker([<%= $marker->{lat} %>,<%= $marker->{lon} %>], {icon: <%= $marker->{icon} %>}).addTo(map);
% }
% else {
marker = L.marker([<%= $marker->{lat} %>,<%= $marker->{lon} %>]).addTo(map);
% }
% if ($marker->{title}) {
marker.bindPopup('<%= $marker->{title} %>');
% }
% }
</script>
<div class="container" style="margin-top: 1ex; margin-bottom: 1ex; color: #555;">
Die eingezeichnete Route stammt aus dem HAFAS und ist im Detail oft
fehlerbehaftet.<br/>
Die Zugposition auf der Karte ist eine DBF-eigene Schätzung und kann erheblich
von den tatsächlichen Gegebenheiten abweichen.
</div>
% if (my $op = stash('operator')) {
<div class="container" style="margin-top: 1ex; margin-bottom: 1ex; color: #555;">
Betrieb: <%= $op %>
</div>
% }
|