Note: This post originated outside of the weblog, but I figured it really belongs here, and it makes it easier to find.
Following in the footsteps of Matt Biddulph, I acquired a Garmin Geko 201 GPS unit, wanting to annotate my digital photographs with location information.
Matt also wrote a Python script to extract the tracklogs and waypoints from the unit and turn them into RDF statements.
I tried it out, and found I had to overcome some dependency problems, as well as do a little tweaking to get all the information I wanted.
The following dependencies applied to the script on my almost clean Redhat 9 laptop installation with Python 2.2.2:
- PyGarmin, which itself doesn’t have any dependencies. It did however need a little patching (diff for garmin.py) to keep Python from complaining.
- Redland, with Python interface.
The libraries should be installed in reverse order…
To keep my version of Python (2.2.2) from crashing, I had to fix some import statements in the original version of Matt’s garmin2rdf.py. Also, a variable name clash was resolved.
Now being able to output an RDF model, I noticed the waypoints only had a property (dc:title) for the name given to it in the unit, but no indication of the symbol used (such as a house, an airport or a building icon). I figured it would be nice to be able to use that information as well, and decided to map each symbol to a Wordnet term, through the use of the Wordnet 1.6 vocabulary namespace.
The Garmin Protocol Specification defines a number of symbols, but the Geko 201 only has a subset of these (and two additional symbols not defined in the specification).
Each numeric symbol ID is mapped to a string identifier such as sym_airport, which in turn (for the Geko 201 symbols only, it’s not easy to create a sensible mapping) is mapped to a Wordnet noun, indicating which type of place is marked. This also fits in nicely with the spacenamespace effort.
When outputting the RDF model, each waypoint is assigned an rdf:type of the wordnet term if found. If no term is found, the string identifier is output as the literal object of a http://hackdiary.com/ns/gps#symbol property, and if no string identifer is found, the symbol ID is output as a literal object of a http://hackdiary.com/ns/gps#symbolid property.
Waypoint symbol mapping
Some of the symbols used relates to verbs, but places need to be identified by nouns. The mapping below doesn’t seem perfect, comments and suggestions are welcomed, especially regarding what to call a place with information (as well as the two special Geko 201 symbols, 8255 and 8256, a closed and an open box)…
|Symbol ID||String identifier||Wordnet term|
- Diff for garmin.py: garmin.py.diff
- Updated extractor/converter: garmin2rdf.py
- Waypoint symbol definitions: garmin_waypoint_symbols.py (needs to be installed somewhere in the Python path).
- Sample output (prettified): waypoints.rdf (including all available terms on the Geko 201).
- Image annotator: point-adder-0.2.pl (example results: Tour de Bristol).
… to mattb and danbri for making this possible.