2021-11-10 10:13:30 +00:00
|
|
|
(function () {
|
|
|
|
let mapEl = document.getElementById('map')
|
|
|
|
let paths = JSON.parse(mapEl.dataset.paths)
|
|
|
|
|
|
|
|
let map = L.map('map')
|
|
|
|
|
|
|
|
L.tileLayer("/x/tiles/{z}/{x}/{y}.png", {
|
|
|
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
|
|
}).addTo(map)
|
|
|
|
|
|
|
|
let polylines = []
|
2021-11-13 19:19:46 +00:00
|
|
|
|
2021-11-10 10:13:30 +00:00
|
|
|
paths.forEach(path => {
|
2021-11-13 19:19:46 +00:00
|
|
|
polylines.push(L.polyline(path.map(point => [point.Lat, point.Lon]), { color: 'blue' }).addTo(map))
|
2021-11-10 10:13:30 +00:00
|
|
|
})
|
2021-11-13 19:19:46 +00:00
|
|
|
|
|
|
|
map.fitBounds(L.featureGroup(polylines).getBounds(), { padding: [5, 5] })
|
2021-11-10 10:13:30 +00:00
|
|
|
})()
|