As an athlete, to be able to visualize a given path before eventually
deciding to go for it, can be of great need. Information about elevation and
where one is located in is key for orientation. The idea of a map ages back
many thousand years ago, and among tech companies, Google maps is by far one
of the most commercially used GPS visualizers, and as far as elevation goes,
they choose to plot it as a 2D plot alongside the path on a map in 2D fashion.
The path taken in a 3D environment as we humans perceive it, is not implemented
here, and other tech companies such as Strava and Polar have no way of plotting a
GPS path as it appears in 3D either. I believe a path visualizer in a 3D environment can
prove very useful for planning exercises among other things.
The program takes a .txt file translated from a .gpx file and parses the elements
in the gpx-format accordingly. One should expect the parsing to work if the .txt file
appears as one long line of text. It has been written this way because downloading
GPX data from the Polar Flow website and converting the .gpx file into .txt results
in the mentioned long line. The parser works for other GPX files than files downloaded
from Polar, but they will need to be converted to .txt first for the parser to work.
The point of parsing the data is to extract the longitude, latitude, elevation
and timestamps, such that they can be stored in various tuples. Further, the tuples
will be used to plot the path in a TGraph2D environment. The path itself is plotted
as a TPolyLine3D object. As tuples hold information, they are of type double, such
that problems regarding precision are taken care of.
The position information is stored as coordinates, and was therefore converted into
a fashion of distance in meters. The fact that the coordinates were converted
is emphasized here mostly due to it altering the input data, and is not straight-
forward operation. An appendix has been made because of this, and can be found in
The coordinate system itself is a TGraph2D object made with the converted
coordinate system valeus in mind. For the pleasure of the user, the axes and labels
are different sizes so that reading the axes is more visually pleasing. Further, the
z-axis is made such that its scale is a tad larger than the largest elevation value
so that the coordinate system gives an intuitive feel for the paths inclines. It
should be noted that the axes are NOT default 1:1:1, it is up to the user to refer
to the axis labels to determine qualitative information. The incline axis (z) is
usually the most affected axis. The lines are drawn as TPolyLine3D objects.
A user might find it convenient to be able to see where he/she has had a certain
speed, where the start- and finish-lines are among other things. Regarding the speed
information, it has been programmed to draw a certain TPolyLine3D with a certain
color everytime the Euclidean distance norm, divided by the change in time between
two points are within a certain threshold (speed between two points). The thresholds
are illustrated in the legend among other relevant pieces of information. A screenshot
of the program interface is shown in the image below:
It should be noted that the script provided needs the .txt file to be inside the
user's directory before the script is to be executed. In the command prompt, the
program runs as: root pathProjectionProgram.C
To conclude, the program is a subject of endless modification and upgrades. It
can benefit from optimization, more interactive options and more compatibility. However,
the idea and the prototype are subject to a potentially useful program or a phone app.
Below are the script and the .txt file used for testing the program. For reference,
the test data are a sample of the Bergen City Marathon.
Download the script
Download the test data as a .txt file