2019-11-15 23:01:50 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col s12">
|
|
|
|
<div id="map" style="height: 500px;">
|
|
|
|
</div>
|
|
|
|
</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') // [] } ) {
|
2019-11-16 13:50:07 +00:00
|
|
|
[[<%= $station->[0][0] %>,<%= $station->[0][1] %>],'<%= $station->[1] %>'],
|
2019-11-15 23:01:50 +00:00
|
|
|
% }
|
|
|
|
];
|
|
|
|
|
|
|
|
var routes = [
|
|
|
|
% for my $pair ( @{stash('station_pairs') // [] } ) {
|
|
|
|
[[<%= $pair->[0][0] %>,<%= $pair->[0][1] %>],[<%= $pair->[1][0] %>,<%= $pair->[1][1] %>]],
|
|
|
|
% }
|
|
|
|
];
|
|
|
|
|
|
|
|
for (var station_id in stations) {
|
2019-11-16 13:50:07 +00:00
|
|
|
L.circle(stations[station_id][0], {
|
2019-11-15 23:01:50 +00:00
|
|
|
color: '#f03',
|
|
|
|
fillColor: '#f03',
|
|
|
|
fillOpacity: 0.5,
|
2019-11-16 13:50:07 +00:00
|
|
|
radius: 250
|
|
|
|
}).bindPopup(stations[station_id][1]).addTo(map);
|
2019-11-15 23:01:50 +00:00
|
|
|
}
|
|
|
|
|
2019-11-16 13:50:07 +00:00
|
|
|
var pl = L.polyline(routes, {color: '#f09', opacity: 0.5}).addTo(map);
|
|
|
|
if (routes.length) {
|
|
|
|
map.fitBounds(pl.getBounds());
|
|
|
|
}
|
2019-11-15 23:01:50 +00:00
|
|
|
|
|
|
|
</script>
|