Position log
The logging app I'm using is
GPS Logger.
I'm storing in GPX
and KML
files. Their formats are as follows:
Keyhole Markup Language: The KML. Is very simple, but also doesn't offer much. It Looks like:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:kml="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom">
<Document><name>2015-08-12T22:01:58Z</name><Placemark><gx:Track>
<!-- Then many repetitions looking like -->
<when>2015-08-12T22:01:58Z</when>
<gx:coord>2.662407 49.23818433 147.0</gx:coord>
</gx:Track></Placemark></Document></kml>
GPS Exchange Format. The GPX format looks like:
<?xml version="1.0" encoding="UTF-8" ?>
<gpx version="1.0" creator="GPSLogger - http://gpslogger.mendhak.com/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0
http://www.topografix.com/GPX/1/0/gpx.xsd">
<time>2015-08-12T22:01:58Z</time><trk><trkseg>
<!-- It then proceeds with repetitions of -->
<trkpt lat="49.24454858" lon="2.67159307">
<ele>148.0</ele>
<time>2015-08-12T22:02:32Z</time>
<course>45.2</course>
<speed>27.89</speed>
<src>gps</src>
<sat>22</sat>
<hdop>1.0</hdop>
<vdop>1.3</vdop>
<pdop>1.6</pdop>
<geoidheight>48.0</geoidheight>
</trkpt>
<!-- Mixed with repetitions of -->
<trkpt lat="52.4060613" lon="6.9069997">
<time>2015-08-13T21:38:19Z</time>
<src>network</src>
<sat>27</sat>
</trkpt>
</trkseg></trk></gpx>
After navigating the spec (combining version 1.0 with the more extensively documented 1.1), the following can be found:
Element Documentation
trkpt
A Track Point holds the coordinates, elevation, timestamp, and metadata for a single point in a track.
lat
The latitude of the point. Decimal degrees, WGS84 datum.
lon
The longitude of the point. Decimal degrees, WGS84 datum.
ele
Elevation (in meters) of the point.
time
Creation/modification timestamp for element. Date and time in are in Univeral Coordinated Time (UTC), not local time! Conforms to ISO 8601 specification for date/time representation. Fractional seconds are allowed for millisecond timing in tracklogs.
course
Instantaneous course at the point. (degrees, true) (only in 1.0)
speed
Instantaneous speed at the point. (meters per second) (only in 1.0)
src
Source of data. Included to give user some idea of reliability and accuracy of data. "Garmin eTrex", "USGS quad Boston North", e.g.
sat
Number of satellites used to calculate the GPX fix.
hdop
Horizontal dilution of precision.
vdop
Vertical dilution of precision.
pdop
Position dilution of precision.
geoidheight
Height (in meters) of geoid (mean sea level) above WGS84 earth ellipsoid. As defined in NMEA GGA message.
Source:
Dilution of precision
Measurements are never exact and always have an error. This modelled as either an interval, or a probability distribution around the true value. The hdop
, vdop
and pdop
values provide an error estimate. According to wikipedia they are defined as:
\begin{aligned} \text{hdop} &= \sqrt{σ_{xx} + σ_{yy}} \\ \text{vdop} &= \sqrt{σ_{zz}} \\ \text{pdop} &= \sqrt{σ_{xx} + σ_{yy} + σ_{zz}} \end{aligned}
The σ's are diagonal elements of the covariance matrix of the four space-time coordinates:
Σ = \operatorname{cov} \begin{bmatrix} x \\ y \\ z \\ t \end{bmatrix} = \begin{bmatrix} σ_{xx} & σ_{yx} & σ_{zx} & σ_{tx} \\ σ_{xy} & σ_{yy} & σ_{zy} & σ_{ty} \\ σ_{xz} & σ_{yz} & σ_{zz} & σ_{tz} \\ σ_{xt} & σ_{yt} & σ_{zt} & σ_{tt} \end{bmatrix} = Σ^T
Since \text{pdop}² = \text{hdop}² + \text{vdop}² we really only have two values out of the ten that are relevant. And we are still missing a description of distribution of the errors. Bbzippo wrote about the error distribution. He/she mentions that the simple assumption of independent normally distributed coordinates agrees well with measurements. Let's run with this assumption.
\begin{aligned} x &\sim N(\bar x, σ_{xx}) & y &\sim N(\bar x, σ_{yy}) & z &\sim N(\bar x, σ_{zz}) & t &\sim N(\bar x, σ_{tt}) \end{aligned}
For the elevation, z, we can directly use the distribution. For the time we have no error estimates whatsoever. The horizontal error is a bit more involved, we know \sqrt{σ_{xx} + σ_{yy}} but not the individual values of σ_{xx} and σ_{yy}. If we assume σ_{xx} = σ_{yy} = σ then we can set σ = ½\mathrm{hdop}². We can move further and calculate the horizontal error distribution:
\left\vert \begin{bmatrix} x \\ y \end{bmatrix} - \begin{bmatrix} \bar x \\ \bar y \end{bmatrix} \right\vert = \sqrt{ (x - \bar x)² + (y - \bar y)²} \sim \operatorname{Rayleight} (σ)
Data
cat *.csv | sort > full.csv
echo "time,longitude,latitude,elevation,hdop,vdop" > short.csv
awk 'NR % 100 == 0' full.csv >> short.csv
Plot
- TODO: Give the countries a slight tint http://bl.ocks.org/jasondavies/4188334