I added together two of my hobbies (running and python) into one python package: python-corrida is a small module based on a Fortran program originally designed by Paulo Polito. The module computes a spreadsheet for your training. It was based on a paper that, unfortunately, no one seems to find it anymore... Still, it works!
In addition to the training spreadsheet the module can convert GPX
data from
hand-held or phone GPS to a GeoJSON that is rendered automagically by github.
For the GPX
to GeoJSON
conversion all you need is
GDAL. If you want to use the
command line interface the command is:
ogr2ogr -f "GeoJSON" Running.json Running.gpx tracks
If you want a the python interface, here is a small script I wrote to do the
same as above. It extract only 1 track and the geometry for that track. Most
GPX
from phone apps are in that format, so no harm there. By extracting just
the geometry the GeoJSON
will be ready to be rendered by
github.
And here
the script that performs the conversion.
If you wish to plot it locally just use mplleaflet like in the example below.
import os
import json
import numpy as np
import matplotlib.pyplot as plt
import mplleaflet
with open('./data/2013-04-29-Running.geojson') as f:
gj = json.load(f)
xy = np.array(gj['coordinates']).squeeze()
fig, ax = plt.subplots()
ax.plot(xy[:, 0], xy[:, 1], color='darkorange', linewidth=2)
mplleaflet.display(fig=fig, tiles='thunderforest_landscape')
The frames look "split" due to a site css override in the map HTML. There are ways around this, but I am lazy ;-)
HTML(html)