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"
	<!-- Then many repetitions looking like  -->
<gx:coord>2.662407 49.23818433 147.0</gx:coord>


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/"

	<!-- It then proceeds with repetitions of -->

<trkpt lat="49.24454858" lon="2.67159307">

	<!-- Mixed with repetitions of -->

<trkpt lat="52.4060613" lon="6.9069997">


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.


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} (σ) $$


cat *.csv | sort > full.csv
echo "time,longitude,latitude,elevation,hdop,vdop" > short.csv
awk 'NR % 100 == 0' full.csv >> short.csv


Remco Bloemen
Math & Engineering