At the Hadrian Hotel

At the Hadrian Hotel

Thursday, March 02, 2006

GPSPhotoLinker

While surfing around the net a while back, I came across a neat little application named GPSPhotoLinker. It is a Mac application that will take information from a GPS track file and merge the location information into the EXIF headers of selected JPEG files. Of course, in order to merge track information into a photo, you need to generate a track file. This is easily done with modern handheld GPS units such as the Garmin eTrex Legend. In mid-February I acquired just such a device. With my eTrex in hand and my Canon Powershot A70 camera, I was ready to start using hardware to add location information to my pictures, rather than doing it manually after finding the locations with Google Earth.


For a first test, I took a few pictures just outside of my office like the one at the left. First, I made sure that the eTrex had found enough satellites to display my location and that the time zone was configured correctly. Second, I made sure that the clock on my camera was right. Then I walked around a bit and took some pictures.

The eTrex logs its current location at regular intervals and timestamps each entry. My camera logs the time that each picture is taken in the EXIF header of the JPEG file. It is these two timestamps that GPSPhotoLinker uses to put the right location information into each picture.

Once I had taken the pictures, it was time to download everything to my PowerBook and see what the program could do. Now, I don't use iPhoto when downloading pictures as I have a number of command line tools (based on Phil Harvey's excellent exiftool) that I use to set different EXIF and IPTC fields such as copyright and keywords. Instead of using iPhoto, I simply copy the JPEG files into a folder on my Desktop, open the folder, and fire up Terminal. I 'cd' to the folder and use some of my tools to add copyright, keywords, and whatever else I might want. I also run a script that adds a "GPS template" to every image I want to GPS tag. I'll explain why a bit later.

With the images prepared, I connect the eTrex to a USB-to-serial adapter, launch GPSPhotoLinker, and use its "Download Tracks" function to download the track log to my Documents folder. The next step is to load the photos into GPSPhotoLinker. Once the photos are loaded, it is now possible to add the GPS location information to each image file. The program allows you to "link" photos individually or in a batch. The "standard" mode displays 3 possible options for location values to use on your picture. Based on the timestamp in the image you will see the track point immediately preceding the photo time, the the track point immediately following, and a time-weighted average location. All three options have a "View on map" button and a "Save to photo" button. These buttons do just what you think they do. Choose the track point that most closely represents the location at which the photo was taken and click on the "Save to photo" button.

If you're trying to save coordinates to multiple photos, you can use GPSPhotoLinker's batch mode. Here you have a number of options. You can have the program select the nearest recorded point or a time-weighted average of points that are within a specified number of seconds, a specified number of meters, or a combination of the two. All-in-all, this is a very flexible program.

I said earlier that I needed to add a GPS template to the photos before I could run GPSPhotoLinker against them. Without a template, every time I added GPS information to a photo, the "maker notes" section of the EXIF header would be corrupted (I found this when I later tried to change another EXIF header value with exiftool). The corruption was verified using exiv2, on which GPSPhotoLinker is based. However, between the time I started writing this post (Thursday night) and now (Friday night) a new version of GPSPhotoLinker (1.3.5), based on a newer version of exiv2, was made available to me. This version does not corrupt the maker notes in the EXIF header, so I no longer need to pre-process the files before running GPSPhotoLinker.

On Sunday I leave for the O'Reilly ETech conference in San Diego, where I plan on taking a bunch of pictures and geocode them using GPSPhotoLinker. To see the result, take a look at my flickr photos tagged with etech06.

Technorati Tags: , , , ,

No comments: