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
<?xml version="1.0"?>
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
<trkpt lat="-33.8477181" lon="151.2311488">
</trkpt>
<trkpt lat="-33.8484844" lon="151.2328439">
</trkpt>
<trkpt lat="-33.8474864" lon="151.2312775">
</trkpt>
<trkpt lat="-33.8463993" lon="151.23095570000001">
</trkpt>
<trkpt lat="-33.8447063" lon="151.230462100000011">
</trkpt>
<trkpt lat="-33.8442964" lon="151.230118800000014">
</trkpt>
<trkpt lat="-33.8432984" lon="151.229754">
</trkpt>
<trkpt lat="-33.8425855" lon="151.229754">
</trkpt>
<trkpt lat="-33.8421578" lon="151.230140299999988">
</trkpt>
<trkpt lat="-33.8420152" lon="151.2300974">
</trkpt>
<trkpt lat="-33.8408567" lon="151.2302905">
</trkpt>
Thanks