summaryrefslogtreecommitdiff
path: root/templates/_map.html.ep
diff options
context:
space:
mode:
Diffstat (limited to 'templates/_map.html.ep')
-rw-r--r--templates/_map.html.ep17
1 files changed, 17 insertions, 0 deletions
diff --git a/templates/_map.html.ep b/templates/_map.html.ep
index cceec01..31223ed 100644
--- a/templates/_map.html.ep
+++ b/templates/_map.html.ep
@@ -19,6 +19,12 @@ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
+var markers = [
+% for my $marker ( @{stash('marker_coordinates') // [] } ) {
+[<%= $marker->[0] %>,<%= $marker->[1] %>],
+% }
+];
+
var stations = [
% for my $station ( @{stash('station_coordinates') // [] } ) {
[[<%= $station->[0][0] %>,<%= $station->[0][1] %>],'<%= $station->[1] %>'],
@@ -31,6 +37,12 @@ var routes = [
% }
];
+var blue_routes = [
+% for my $pair ( @{stash('blue_routes') // [] } ) {
+[[<%= $pair->[0][0] %>,<%= $pair->[0][1] %>],[<%= $pair->[1][0] %>,<%= $pair->[1][1] %>]],
+% }
+];
+
for (var station_id in stations) {
L.circle(stations[station_id][0], {
color: '#f03',
@@ -40,7 +52,12 @@ for (var station_id in stations) {
}).bindPopup(stations[station_id][1]).addTo(map);
}
+for (var marker_id in markers) {
+ L.marker(markers[marker_id]).addTo(map);
+}
+
var pl = L.polyline(routes, {color: '#f09', opacity: 0.5}).addTo(map);
+L.polyline(blue_routes, {color: '#09f', opacity: 1}).addTo(map);
if (routes.length) {
map.fitBounds(pl.getBounds());
}