myGPXData
was the result of a weekend exercise extracting running data
(as in exercise/fitness) from my fitness tracking app and learning how it works.
The goal of this package is to take a gpx file and:
- draw/trace its track points to a graphic; saving to disk or returning as a string.
- extract popular stats (for running); distance, duration, splits, pace and climb.
As of 2016-01-17, extracting stats have been added.
As of 2016-01-01, myGPXData is alpha version and only renders gpx to svg. Does not current
extract stats.
Note: This package does not render the gpx route on top of a map (ie. openstreetmaps, google maps). Only the route is rendered.
pip install git+git://github.com/jimle-uk/mygpxdata.git
BSD. See LICENSE
from mygpxdata import mygpxdata
gpxdata = mygpxdata()
gpxdata.open("/path/to/file.gpx")
# output width and height is required
width = 320
height = 240
output = gpxdata.renderToString(size=(width, height))
# output = "<?xml version="1.0" encoding="utf-8" ?>..." etc
gpxdata.renderToFile("/path/to/file.svg", size=(width, height))
print "total distance: ", gpxdata.getTotalDistance()
# returns total is in meters eg. "4489.14574646"
print "total duration: ", divmod(gpxdata.getTotalDuration(), 60)
# returns total in seconds. Divmod for minutes eg. "(47, 3)" means 47mins 30secs
print "total climb: ", gpxdata.getTotalClimb()
# returns total climb in meters eg. "50.3"
print "splits", gpxdata.getSplits()
# returns array of tuples of (distance(mtrs), duration(secs), climb(mtrs), pace(secs)) per ~1km (default) of total distance. eg. [(1004.1364255006434, 483, 7.299999999999994, 481.0103365777068), ... ]
print "average pace", divmod(gpxdata.getAveragePace(), 60)
# returns average pace per km in seconds. Divmod for minutes. eg. "(9.0, 17)" means 9mins 17secs
Finish adding gpx stats; distance, duration, splits, pace and climb- Try out different renderers ie. data-url, canvas
- Documentation, tests etc