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: '../gpx/20260314_london_italy/images/pin-icon-start.png',
                endIconUrl: '../gpx/20260314_london_italy/images/pin-icon-end.png',
                shadowUrl: '../gpx/20260314_london_italy/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, '../gpx/20260314_london_italy/2026-02-27-London.gpx', 'purple')
addGPX(map, '../gpx/20260314_london_italy/2026-02-28-Tendring.gpx', 'purple')
addGPX(map, '../gpx/20260314_london_italy/2026-03-01-Rotterdam.gpx', 'purple')
addGPX(map, '../gpx/20260314_london_italy/2026-03-05-Amsterdam.gpx', 'purple')
addGPX(map, '../gpx/20260314_london_italy/2026-03-06-Tilburg.gpx', 'purple')
addGPX(map, '../gpx/20260314_london_italy/2026-03-07-Liege.gpx', 'purple')
addGPX(map, '../gpx/20260314_london_italy/2026-03-08-Luxembourg.gpx', 'purple')
addGPX(map, '../gpx/20260314_london_italy/2026-03-09-BaD.gpx', 'purple')
addGPX(map, '../gpx/20260314_london_italy/2026-03-10-Strasbourg.gpx', 'purple')
addGPX(map, '../gpx/20260314_london_italy/2026-03-11-Kirchzarten.gpx', 'purple')
addGPX(map, '../gpx/20260314_london_italy/2026-03-12-Montreux-failed.gpx', 'red')
