28 Jul 2008

Photo tutorial, part 1 - Geotagging

With the one and only hugin edging towards a release, I thought it might be worth typing up a series of notes about the photo editing tools I've been using lately.

So the first bulletin is about Geotagging using Linux. There are quite a few tutorials out there, and they're all, quite frankly, rubbish. Here's what I do and how I do it. Three packages are required: exiftool, gpsbabel and gpscorrelate.

First, get yourself a sweet, cheap yellow eTrex and a data cable. I am SICK, SICK, SICK of all the morons on Panoramio, Geograph, Flickr etc who are incapable of pinpointing the correct location on a map. BUY A BLOODY GPS!

Just before you start photographing, turn the GPS on, get a fix, and change the display so that it shows the time of day, and take a photo of it. Carry the GPS with you, enjoy yourself, take nice photos.

Then come home and upload your photos to a nice clean new directory. First, we're going to use exiftool to adjust the EXIF date-time of all the photos according to the GPS date-time that was shown on your eTrex when you photographed it.

Look at the photo of your eTrex. For example, if the time in the EXIF data is 21 seconds earlier than the time shown on the GPS, you need to add 21 seconds to the EXIF data using the command

exiftool -AllDates+="0 0:0:21" .
This will correct the EXIF date-time of all the photos in the current directory (use your common sense - if the time in the EXIF data is one minute 18 seconds later than the time shown in the photo, use -AllDates-="0 0:1:18"). It'll create new copies of all the files; the originals will be renamed from *.jpg to *.jpg_original.

I mean, obviously, given the inevitable small discrepancy between your camera's time and the GPS's time, the GPS is the one that's right, right? So you want to fix all your photos, right? And you can do this all in one go with just one exiftool command, right? So why the bloody hell don't any of the bozotic so-called tutorials out there ever mention it?

But don't attempt to compensate for time zone differences at this stage. You'll want your photos to have the correct local time in the EXIF data (since you're about to write some additional tags that contain lat/long and UTC.)

Next, plug in your eTrex with your data cable. Turn on the eTrex, make sure that SETUP -> INTERFACE has I/O FORMAT set to GARMIN, and use gpsbabel to grab a copy of the active track log. (My data cable is serial and plugged into ttyS0; YMMV.)
gpsbabel -t -i garmin -f /dev/ttyS0 -o gpx -F tracklog-$(date '+%Y-%m-%d:%T').gpx
And now fire up gpscorrelate-gui.



Click the 'Add...' button and select all your photos. Click the 'Choose...' button and select your track log. Now set 'Max gap time' to something like 300 seconds, and set your time zone (negative is west of the prime meridian) - it'll remember these two values, so you won't need to set them every time. Don't tinker with the Photo Offset! Leave it at 0! And finally, just click 'Correlate Photos' and watch the miracle of geotagging unfold in the blink of an eye.

Easy, innit?

0 comments: