Newer
Older
gpx_web_viewer / js / gpx.js
@lagfra lagfra 1 day ago 858 bytes fix paths
var map = L.map('map');

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);

function addGPX(map, gpx, lineColor) {
    new L.GPX(gpx, {
            async: true,
            marker_options: {
                startIconUrl: 'images/pin-icon-start.png',
                endIconUrl: 'images/pin-icon-end.png',
                shadowUrl: 'images/pin-shadow.png'
            },
            polyline_options: {
                color: lineColor,
                opacity: 1,
                weight: 3,
                lineCap: 'round'
            }
    }).on('loaded', function(e) {
        map.fitBounds(e.target.getBounds());
    }).addTo(map);
}

addGPX(map, '../tracks/turin_09122022.gpx', 'red')
addGPX(map, '../tracks/biella_27122022.gpx', 'blue')