Garmin TCX and GPX file readers for running activities.
Project description
activereader
Python library for reading Garmin TCX and GPX running activity files.
Example
activereader provides the Tcx
and Gpx
file reader classes.
TCX and GPX files can be exported from Garmin Connect.
Use Tcx
to read and access data from a TCX file:
import pandas as pd
from activereader import Tcx
reader = Tcx.from_file('tests/testdata.tcx')
# Build a DataFrame using only trackpoints (as records).
initial_time = reader.activity_start_time
records = [
{
'time': int((tp.time - initial_time).total_seconds()),
'lat': tp.lat,
'lon': tp.lon,
'distance': tp.distance_m,
'elevation': tp.altitude_m,
'heart_rate': tp.hr,
'speed': tp.speed_ms,
'cadence': tp.cadence_rpm,
} for tp in reader.trackpoints
]
df = pd.DataFrame.from_records(records)
Background
This project originated as the file-reading part of my heartandsole package. Lately, I've been interested in keeping my work in more self-contained modules with lighter dependencies, so I split it out.
The idea is to provide a simple API for accessing data from Garmin files, similar
to the way python-fitparse
provides access to Garmin's impenetrable .fit
files. I don't aim to do everything,
though; I want to just focus on activity files that represent runs (and maybe walks/hikes)
for now. When I try to cover all cases, the schemas and profiles quickly grow out of
control. Garmin seems to have a reputation for making their files indecipherable, and
I like solving puzzles, so I will focus on translating Garmin's language into human language.
This is in opposition to waiting for Garmin to document all the features of all its files.
Tangent time: when I was working on picking apart Garmin's.fit
file structure with my own
device's files, there were a number of undocumented, indecipherable fields. Add to that,
Garmin does not seem to keep documentation online for its older .fit
SDKs, so if your
device uses an older one, you might just be out of luck trying to decipher it. I would
rather keep my own separate source of truth, than count on Garmin's being forthcoming
with info.
Dependencies and Installation
lxml and python-dateutil are required.
The package is available on PyPi and can be installed with pip
:
$ pip install activereader
License
This project is licensed under the MIT License. See LICENSE file for details.
Project Status
The project has reached a stable point and I don't expect to be changing much for now - future versions will likely build on what's here. But sometimes I change my mind and tear everything apart, so who knows. This package will remain focused on extracting data from GPX and TCX files...of that I feel sure.
Complete
- Develop capability to read running
tcx
andgpx
files.
Current Activities
- Handle pauses and laps in files (things I avoid in my own workouts because they complicate and obscure the DATA!). The body keeps the score, but the watch keeps the stats.
Future Work
-
Expand capability to read running activity files
.pwx
(is this Garmin?)
-
Make a project wiki so I can be as verbose as I please. (You mean this isn't you being verbose?)
Contact
Reach out to me at one of the following places!
- Website: trailzealot.com
- LinkedIn: linkedin.com/in/aarondschroeder
- Twitter: @trailzealot
- Instagram: @trailzealot
- GitHub: github.com/aaron-schroeder
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file activereader-0.0.2.tar.gz
.
File metadata
- Download URL: activereader-0.0.2.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b14deba5c2076e0c807db8b511d9aa934ad1d64ef7a59990487ce83fdd523c66 |
|
MD5 | 5a1892fc28f95a9107cf4106df615bf7 |
|
BLAKE2b-256 | 9c722b17d2f98426395a0a1211faeace2a685b0aa2e3e62da2080b81f88c1b65 |
File details
Details for the file activereader-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: activereader-0.0.2-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d17e139584fd3ec85e71a0f4cf5417e8f1378bc8a51ce6fd33879e297cde7151 |
|
MD5 | 65f9c1a2d787a98e19a7b9e5742b05e1 |
|
BLAKE2b-256 | 0b047cb60814772f9fc28cab998d183227e99305f3bcebf231a701f2313fd868 |