GPX on OSM - showing track name

I have a gpx file with several tracks. How can I display the name of the track that I have clicked on? It always gives the name of the first track in the file.

The code I use is

.on(‘click’, function(e) {
//map.fitBounds(e.target.getBounds());
alert(e.target.get_name());
}

Part of the file:

type or paste code here
2023-02-08 Taronga Zoo Wharf to Mosman Bay 1 of 989 1 2023-01-25 Cremorne Wharf to Old Cremorne 1 of 2 1























Thanks

4 posts - 2 participants

Read full topic


Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/gpx-on-osm-showing-track-name/8899