1
0
Fork 0
This repository has been archived on 2023-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
kekskurse.de-old/layouts/shortcodes/gpx.html
2020-11-30 22:55:25 +01:00

28 lines
No EOL
1,008 B
HTML

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-gpx/1.4.0/gpx.min.js"></script>
<div id="mymap" class="mymap" style="min-height: 500px;"></div>
<style type="text/css">
.mymap img {
border: 0px;
}
</style>
<script>
var map = L.map('mymap');
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="http://www.osm.org">OpenStreetMap</a>'
}).addTo(map);
var gpx = '{{ .Get "gpx" }}'; // URL to your GPX file or the GPX itself
new L.GPX(gpx, {
marker_options: {
startIconUrl: '/img/general/pin-icon-start.png',
endIconUrl: '/img/general/pin-icon-end.png',
shadowUrl: '/img/general/pin-shadow.png'
},
async: true
}).on('loaded', function(e) {
map.fitBounds(e.target.getBounds());
}).addTo(map);
</script>