GeoTagging in EXIF (resumed)

After almost a year after I had done some initial experiments with geotagging my images. I decided to pursue this idea further. I also realized that taking an approach “It’s simple let’s write in Perl” is good, but “Let’s see if somebody hasn’t done it yet” is even better ;-)

First, I recall I had some problems with reading GPS data and hacked gpstransfer to do this. In the meantime, I found out that [pygarmin](http://pygarmin.sourceforge.net/pygarmin) is a nice and working interface to Garmin GPSs, which works. More recently I discovered a much better and more versatile tool [gpsbabel](http://www.gpsbabel.org/). Like the tower of Babel it really does speak all the languages (including plurality of GPS and very exotic formats (see [here](http://www.gpsbabel.org/capabilities.html)). The user interface is a bit weird and not all types of information (i.e. waypoints, tracks) are supported in all formats. Sadly, if the format is not supported, the program does transfer all the data (which takes a while) and prints nothing just to confuse you ;-)

After a bit of experimenting I discovered a magic formula:

gpsbabel -t -i garmin -f /dev/ttyS0 -o psitrex -F

“psitrex” stands for KuDaTa PsiTrex format, however, as exotic as it sounds, it is just a comma separated format. I tried a couple of others (actually all of them in my version (1.2.7) and the only ones I found useful were:

* psitrex -> an easy to parse CSV format
* gpx -> produces results in XML
* nmea -> looks ok, but does not show the start and end of each segment, which is useful for determining whether to interpolate data or not.

I also revisited my geotagging script. First, as Diego pointed out there’s a nice tool on Mac to do this: [iPhototoGoogleEarth](http://www.macupdate.com/info.php/id/22283), which unfortunately doesn’t work on intel-Macs yet. For geotagging they use [GPSPhotoLinker](http://oregonstate.edu/~earlyj/gpsphotolinker/), which in turn uses gpsbabel. So at the end we use the same backend tool.

In the meantime I revisited my geotagging script and made it a bit more useful adding a bunch of options, debugging it, etc. Now that I actually use it on my photos, I had to make sure that it actually works ;-)

Here it is:

$ ./geotag.pl
ERROR: Need track file to proceed – use -t
Usage:
./geotag.pl -t
[-b] [-f] [-s ] [-a ] [-n ] [-z ] files_to_process…

Where:
-b -> keep backup,
-f -> force, overwrites an existing EXIF tag (or removes it)
-s -> time shift (in case of time discrepancies)
-a -> approximate non-continuous segements in the tracklog (default 300s)
-n -> don’t approximate but take the closest segment (default 10800s)
-z -> use the follwoing timezone for your camera (default current timezone)

can be best created using gpsbabel (http://www.gpsbabel.org):
(e.g. Serial Garmin GPS: gpsbabel -t -i garmin -f /dev/ttyS0 -o psitrex -F
)
at ./geotag.pl line 288.

Now what do I do with the script? Well… I wrote a [gallery2](http://gallery.menalto.com/) plugin to display google maps. See [this post](http://tadek.pietraszek.org/blog/2006/08/31/gallery2-plugin-displaying-googlemaps-with-gps-coordinates-from-exif/).

5 Responses to “GeoTagging in EXIF (resumed)”

  1. Craig Says:

    I thought you might like to know that iPhotoToGoogleEarth is now Intel compatible :-)

  2. Jean-Marc Liotier Says:

    Exactly the information I was looking for ! Thank you ! You are my hero of the day !

  3. Jean-Marc Liotier Says:

    Now if I could find where to download geotag.pl I would be happy… Do you have a link to it ? I found none on this page…

  4. activityworkshop Says:

    Heh- a german magazine (ctmagazin) talks this week about a perl script called geotag.pl, Google led me here but I’m guessing it’s not the same script…
    Anyway, hello from a fellow foreigner in Zürich! Happy hiking!

  5. Web 2.0 Announcer Says:

    Tadek?s Blog » Blog Archive » GeoTagging in EXIF (resumed)…

    [...][...]…

Leave a Reply