Title : Cycling / bike trips and opensource
Author: Solène
Date  : 06 February 2020
Tags  : biking

# Introduction

I started doing biking seriously a few months ago, as I love having statistics
I needed to gather some. I found a lot of devices on the market but I prefered
using opensource tool and not relying on any vendor.

The best option to do so for me was reusing a 6 years old smartphone on which
the SIM card bus is broken, that phone lose the sim card when it is shaked a
little and requires a reboot to find it again, I am happy I found a way to
reuse it.

Tip: turn ON airplane mode on the smartphone while riding, even without a SIM
card it will try to get network and it will draw battery + emitting useless
radio waves. In case of emergency, just disable the airplane mode to get access
to your local emergency call number. GPS is a passive module and doesn't
require any network.

This smartphone has a GPS receiver, it's enough for recording my position as
often I want. Using the correct GPS software from F-droid store and a program
for sftp transfer, I can record data and transfer it easily to my computer.

The most common file format for recording GPS position is the GPX format, it's
a simple XML file containing all positions with their timestamp, sometimes with
a few more information like speed at that time, but given you have all
positions, software can calculate the speed between each position.


# Android GPS Software

It seems GPS software for recording GPX tracks are becoming popular, and in the
last months, lot of new software appeared, which is a good thing, I didn't
tested all of them though but they tend to be more easy to use and
minimalistic.


## OpenStreetMap app - OSMand~

You can install it from [F-droid](https://f-droid.org/) an alternate store for
Android only with opensource software, it's a full free version (and
opensource) compared to the one you can find on Android store.

This is OpenStreetMap official software, it's full of features and quite
heavy, you can download maps for navigation, record tracks, view tracks
statistics, contribute to OSM, get Wikipedia information for an area and
everything of this while being OFFLINE. Not only on my bike, I use it all the
time while walking or in my car.

Recorded GPX can be found in the default path
**Android/data/net.osmand.plus/files/tracks/rec/**


## Trekarta

I found another software named **Trekarta** which is a lot more lighter than
OSM, but only focuses on recording your tracks. I would recommend it if you
don't want any other feature or have a really old android compatible phone or
low disk space.


# Analyzing GPX files / keep track of everything

I found Turtlesport, an opensource software in Java for which last release was
years ago but still work out of the box, given you have a java implementation
installed. You can find it [at the following
link](https://turtlesport.sourceforge.io/EN/home.html).

    /usr/local/bin/jdk-1.8.0/bin/java -jar turtlesport.jar

Turtlesport is a nice tool for viewing tracks, it's not for only for cycling
and can be used for various sports, the process is the following:

- define sports you do (bike, skateboard, hiking etc..)
- define equipments you use (bike, sport shoes, skis etc..)
- import GPX files and tell Turtlesport which sport and equipment it's related to

Then, for each GPX file, you will be able to see it on a map, see elevation and
speed of that track, but you can also make statistics per sport or equipment,
like "How many km I ride with that bike over last year, per week".

If you don't have a GPX file, you can still add a new trip into the database by
drawing the path on a map.

In the equipments, you will see how many kilometers you used each, with an
alert feature if the equipment goes beyond a defined wearing limit. I'm not
sure about the use of this, maybe you want to know your shoes shouldn't be used
for more than 2000 km?? Maybe it's possible to use it for maintenance purpose,
says your bike has a wearing limit of 1000 km, when you reach it you get an
alert, do your maintenance and set the new limit to 2000km.


# Viewing GPX files

From OpenBSD 6.7 you can install the package **gpxsee** to open multiple GPX
files, they will be shown on a map, each track with a different colour, and
nice charts displaying the elevation or speed over the travel for every tracks.

Before **gpxsee** I was using the GIS (Geographical Information System) tool
**qgis** but it is really heavy and complicated. But if you want to work on
your recorded data like doing complex statistics, it's a powerful tool if you
know how to use it.

I like to use it in a **gamification** purpose: I'm trying to ride over every
road around my home, viewing all GPX files at the same time allow me to plan
the next trip where I never went.


# Miscellaneous

## Create an unique GPX file from all records

It is possible to merge GPX file into one giant one using **gpsbabel** .I was
using this before having **gpxsee* but I have no idea about what you can do with
that, this create one big spaggheti track. I choose to keep the command here,
in case it's useful for someone one day:

    gpsbabel -s -r -t -i GPX $(ls /path/to/files/*gpx | awk '{ printf "-f %s ", $1 }') -o GPX -F - > sum.gpx


## Cycling using electronic devices

Of course, if you are a true cyclist racer and GPX files will not be enough for
you, you will certainly want devices such as a power meter or a cadence meter
and an on-board device to use them. I can't help much about hardware.

However, you may want to give a try to [Golden
Cheetah](https://www.goldencheetah.org/) to import all your data from various
devices and make **complex** statistics from it. I tried it and I had no idea
about the purpose of 90% of the features.


## Have fun

Don't forget to have fun and do not get obscessed by numbers!