Python script illustrating how to generate a HTML page with a Leaflet map showing a GPX track.
I have created a series of short blog posts about the script here
- About the Python script and generating the HTML and JavaScript: https://dev.to/coderallan/gpx-track-to-leaflet-map-3m93
- Calculating the distance and duration of the gpx track here: https://dev.to/coderallan/distance-and-duration-of-you-hiking-trip-29dj
- Adding markers to the Leaflet map: https://dev.to/coderallan/distance-and-duration-of-you-hiking-trip-29dj
- Clicking the track and calculating the distance from start to the clicked point: https://dev.to/coderallan/leaflet-onclick-event-1468
You have to provide your own myTrack.gpx file and place it in the folder next to the script.
Then in you command prompt just run:
python gpxToLeaflet.py
Have a look at some of the other good articles on Dev about Leaflet.