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.
Dependencies
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…
Waypoints tweaking
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 |
---|---|---|
0 | sym_anchor | Harbour-1 |
6 | sym_dollar | Bank-4 |
7 | sym_fish | Fishery-1 |
8 | sym_fuel | Gas_station-1 |
10 | sym_house | Home-1 |
11 | sym_knife | Restaurant-1 |
14 | sym_skull | Danger_zone-1 |
18 | sym_wpt_dot | Train_station-1 |
19 | sym_wreck | Wreck-4 |
150 | sym_boat_ramp | Lake-1 |
151 | sym_camp | Campground-1 |
152 | sym_restrooms | Restroom-1 |
155 | sym_phone | Telephone-1 |
156 | sym_1st_aid | Hospital-1 |
157 | sym_info | Information-2 |
159 | sym_park | Park-1 |
160 | sym_picnic | Park-2 |
161 | sym_scenic | Sight-2 |
162 | sym_skiing | Mountain-1 |
163 | sym_swimming | Beach-1 |
170 | sym_car | Parking_lot-1 |
171 | sym_deer | Zoo-1 |
173 | sym_lodging | Lodging-1 |
175 | sym_trail_head | Spot-1 |
178 | sym_flag | Place-1 |
8197 | sym_golf | Golf_course-1 |
8234 | sym_building | Building-1 |
8255 | sym_8255 | Place-1 |
8256 | sym_8256 | Place-1 |
16384 | sym_airport | Airport-1 |
16395 | sym_parachute | Amusement_park-1 |
Files
- 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).
Thanks
… to mattb and danbri for making this possible.