Fork me on GitHub

geoHist v0.2 alpha

NOTE: I no longer use or maintain this software. I've been told that this no longer works with the current version of GPSD due to non-trivial API changes, and I have no plans to update the software as I don't use it and have no easy way to test it. Sourcecode history is available on github at https://github.com/virtuald/geohist

Download geoHist v0.2.1

geoHist is a (relatively) simple program I wrote to log GPS data retrieved from GPSD into a
mysql database. It is designed to meet the following requirements:

  • Standalone
  • Run from system startup to shutdown
  • Small/fast, non-intrusive
  • Robust
  • Log data to an SQL database
  • Export to GPX

Description

geoHist will poll GPSD every 10 seconds and then send that data to a
preconfigured MySQL database. It will attempt to detect if you are standing
still, and if you are then it will NOT log the data. It decides this using a
simple drift factor. It will always log position to the database at least
once if there is a satellite fix.

There is a program, geohistdump that can be used to export the GPS data from
the MySQL database into a GPX formatted file. By default, it will export a GPX
1.0 file (because there is more information that can be output), but you can
export to GPX 1.1 with the -v 1.1 option.

I designed geoHist to be used with my linux-based car computer. It is designed
to be configured once, and (ideally) never touched again (except to export
data).

System Requirements

geoHist main:

  • GPSD (http://gpsd.berlios.de)
  • A GPS device that works with GPSD
  • MySQL (http://www.mysql.com)

Upgrade script (from 0.1.x to 0.2.x):

  • PHP cli w/ mysql extension installed

Installation

(if you are upgrading, see the Upgrade section)

This is your typical autotools-based install...

    tar -xjf geoHist-XXX.tar.bz2
    ./configure
    make && make install

Then, you need to create the table for geoHist to log stuff to.

    mysql -u root -p < geoHist.sql

You will need to add geoHist to your system startup scripts somehow. I have
included a sample gentoo rcscript called geohist.init.gentoo, which should be
copied to /etc/init.d/geohist. You can then run rc-update add geohist default
and it should start at bootup. There is an ubuntu/debian init script also,
called "geohist.init.ubuntu"

At the moment, there are no configuration files because I personally don't
feel the need to do so at the moment. If you want to change something, then
you must modify src/geohist.h, change the appropriate variables, and
recompile. Feel free to send me a patch to fix that.

If you are having issues or to verify proper configuration, then you can run
./configure using the option --enable-debug . Then you can run geoHist and
it will print messages out to the console and tell you what its doing at
the moment.

Upgrade

The database format has changed for geohist 0.2, and you can use migrate.php
to add the necessary data to the database. Just open the file and comment out
the first die() in the file.

Export database to GPX Format

There is now a way to dump the data to a GPX file. You can
now use the geohistdump program to do this.

Usage: geohistdump -adeflnrv [-t tracklist] [output filename or - for stdout]

  -l    list tracks
  -r    delete tracks (requires -t)
  -f    force delete tracks

GPX Output Options

  -n    File name/title
  -a    Author name
  -d    Description
  -e    Email address of author
  -v    GPX output format (1.0 [default] or 1.1)

Note that when you specify multiple tracks, they are actually written
to the GPX file as track segments, as part of one big track.

If you are interested in validating the resulting XML file, you can use
xmllint (from libxml2-utils in ubuntu) to do it:

GPX 1.0 (default geoHist output)
xmllint --noout --schema http://www.topografix.com/GPX/1/0/gpx.xsd testfile.gpx

GPX 1.1
xmllint --noout --schema http://www.topografix.com/GPX/1/1/gpx.xsd testfile.gpx

Comments/Questions

Feel free to drop me a line if you have any questions. If you have changes,
improvements, bugfixes, or whatever -- send me a patch. :)