This project provides a set of Python scripts for visualizing and manipulating GPS data from .gpx and .tcx files. It's designed for cyclists, runners, and outdoor enthusiasts who want to analyze their activity data.
A graphical user interface (GUI) application built with tkinter that allows you to:
- Split GPX Files: Extract a specific segment from a GPX track based on start and end distances in kilometers.
- Visualize Tracks: Automatically generates an HTML map comparing the original track with the newly split segment.
- Overlay GeoJSON Data: Display points of interest (e.g., train stations) from a GeoJSON file on the map to see how they relate to your route.
- Save & Load Configuration: Remembers your last-used file paths and settings for convenience.
A command-line script that:
- Parses TCX Files: Extracts GPS coordinates, heart rate, and speed data from
.tcxfiles. - Calculates Key Statistics: Computes total distance, duration, average pace, average/max speed, and average/max heart rate.
- Generates an HTML Summary: Creates a detailed and beautifully styled HTML page with a
foliummap of your route and a table of all key statistics.
You need Python installed, along with the following libraries:
pip install gpxpy haversine folium lxml- Run the main application from your terminal:
python main.py
- Input GPX File: Click "Browse..." to select the
.gpxfile you want to split. - Output GPX File: Click "Save As..." to choose a name and location for the new, smaller
.gpxfile. - Stations GeoJSON (Optional): If you have a
.geojsonfile with points of interest (liketreinstation.geojson), select it here. - Start and End (km): Enter the start and end distances for the segment you want to extract.
- Split and Visualize: Click the button. The script will create the new GPX file and open a map in your web browser showing the original and split tracks.
The TCX viewer is designed to be called from another script or run with a file path. To use it, you would typically import it:
from tcx_viewer import create_tcx_visualization
# Path to your TCX file
tcx_file = 'path/to/your/activity.tcx'
# Generate and open the summary
create_tcx_visualization(tcx_file)This will generate an _summary.html file in the same directory as the TCX file and open it automatically.
main.py: The main GUI application for splitting GPX files.tcx_viewer.py: The script for parsing and visualizing TCX files.treinstation.geojson: An example GeoJSON file containing train station data.config.json: A configuration file automatically generated bymain.pyto store your settings.README.md: This file.