Skip to content

conor3618/gpx-run-analyser-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

GPX Run Analyser

A lightweight Python script that parses GPX running files and exports key metrics to a CSV file. Drop your .gpx files into a folder, run the script, and get a clean summary of every run — without reprocessing files you've already analysed.


Formulas

Speed (km/h)

speed = distance_km / (moving_time_seconds / 3600)

Average Pace (seconds/km)

pace = moving_time_seconds / distance_km

Calorie Estimate

calories = distance_km * weight_kg * (1.0 + speed * 0.02)

The intensity factor (1.0 + speed * 0.02) scales calories upward at higher speeds to reflect the increased effort of running faster. For example, at 10 km/h the multiplier is 1.2; at 12 km/h it is 1.24.


Output Metrics

Column Description
Date Run date, extracted from GPS timestamps in the file
Dist (km) Total flat distance in kilometres
Moving Time Time spent moving (HH:MM:SS), excluding stops
Avg Pace Average pace in MM:SS per kilometre
Calories Estimated calories burned
Filename GPX filename (used internally to track processed files)

Usage

python gpx_run_analyser.py

On each run, the script will:

  • Skip any files already recorded in the CSV
  • Analyse only new .gpx files
  • Append results to the CSV, sorted by date (most recent first)
  • Print your 5 most recent runs to the terminal

How It Works

Each .gpx file contains GPS track points with embedded timestamps, coordinates, and elevation data. The script:

  1. Parses each file using gpxpy
  2. Extracts moving time by ignoring periods where speed drops below 1.0 m/s
  3. Calculates flat distance from 2D coordinates
  4. Reads the run date from the first GPS timestamp in the file
  5. Estimates calories based on distance, speed, and athlete weight
  6. Saves results to a CSV, recording the filename to avoid duplicate processing on future runs

Example Output

Date         Dist (km)  Avg Pace  Calories
2026-02-20       8.30      5:12       621
2026-02-17       5.10      5:28       374
2026-02-14      10.05      5:05       768

Notes

  • You must set WEIGHT_KG and DATA_DIR before running the script.
  • Files are tracked by filename. Renaming a processed file will cause it to be analysed again.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages