Using Google Latitude for geotagging photos

Ups, da ist mir doch tatsächlich ein englischer Blogartikel rausgerutscht. Man möge es mir verzeihen. Geotagging photos is pain, if […]

Ups, da ist mir doch tatsächlich ein englischer Blogartikel rausgerutscht. Man möge es mir verzeihen.

Geotagging photos is pain, if you don’t have an integrated GPS chip in your camera (like in a smartphone). Of course, there are some possibilities, like the Nikon GP-1, but it’s expensive and you still have to take action before shooting your photos.

And then there is Google Latitude – a service for tracking yourself and your friends, if they let you. Since late January this year, I have the Google Latitude iPhone App running constantly. It’s great to reconstruct your whereabouts at a specific date and time – for example, if you find a suspicious account transaction in your pass sheet, you can find out where you were at this time and if you actually spent the money yourself or if someone messed around with your credit card.

And… you can find out where you took a photo. Easy to accomplish, you may think, using the ”Export to KML“ function of Google Latitude. But putting this KML file in an photo linking app like PhotoLinker or PhotoGPSEditor won’t work. Even converting the file to the more common gpx file format using GPSBabel won’t work.
It turns out Google isn’t using it’s own KML file format properly – the timestamp of waypoints in a Latitude-exported KML file is not in the correct timestamp format. Converting it just gives you some waypoints with a date as name, but no date in the date field.

Googling around, I found a perl script to convert the Google Latitude KML files to gpx files with correct timestamps. Unfortunately, it didn’t work for me. The Central European Time was not correctly understood by the script, because it was written for the Japanese Time Zone.
Ono Hiroki, the script author, luckily provided me some help and sent me a script that works neat (actually, he updated the script on his site in the meantime).
So now I just have to download the daily Latitude KML file, run it through the script and put the generated gpx files into PhotoLinker, together with my photos.
On his site, Hiroki also provides a FakeApp workflow for automated KML download. But you may also just download the files manually.

Another possibility using Latitude data for geotagging photos is LatiPics, a java-written program that uses the Latitude API. Currently it does only support standard image files like JPG, however (and even this didn’t work for me…). But the author told me via eMail that he is working on a new version he’ll put into the Mac App Store and maybe he will add support for geotagging RAW files like Nikon’s NEF. Until then, Hiroki’s script is a nice workaround.

For it to work, you’ll have to install some perl libraries. On a unix-based system that’s very easy:

%> sudo cpan App::cpanminus
%> sudo cpanm DateTime::Format::DateParse
%> sudo cpanm Geo::Gpx

And you’ll need the command line version of GPSBabel, on OS X you get it out of the .app file:

%> sudo cp /Applications/GPSBabel.app/Contents/MacOS/gpsbabel /usr/local/bin/

Then you can call the perl script on the downloaded Google Latitude KML files:

%> perl kmlwpt2gpx.pl *.kml

This will convert all Latitude kml files in the current directory to working gpx files you can use to geotag your photos.