Wednesday, July 29, 2009

Geotagging photos with your iPhone

Ever since I starting using my iPhone to take photos and upload them to the net, I've really become interested in geotagging my photos. I didn't realize how cool it is to be able to see your photos on a map (or Google Earth) until all my photos started showing up tagged (thanks to the GPS in the iPhone). Having low res photos tagged is cool and all, but I want to tag them with my SLR. You could buy an adapter for you camera from Amazon or you could just use the GPS you're carrying with you every where you go. Here's how:

First, get an app from the app store that logs GPS data points. There are a ton of them, and one app specifically tailored to this called GeoLogTag. Anything that allows you to export your data in a GPX file with times should work. I just use MotionX GPS because it's super cheap for what you get, I use it for hiking as well, and it makes it super easy to share/get the GPX file.

Next you'll need an app that allows you to tie your GPS location and timestamps to your photos. There is a ton of software that does this, but I chose to use a perl script because I wanted something cross platform and any time I can use the command line, I'm happy. You can find the handy dandy perl script called gpsPhoto here. You'll need to install two more perl packages if you don't already have them installed. The site goes over how to install them if you don't already know how.

So let's go step by step:

0. Make sure the time is set correctly on your camera.
1. Turn on MotionX GPS and start logging.
2. Walk around and take pictures like a mofo.
3. When you're done taking pictures, stop MotionX, save the track, and email yourself the GPX log (called sharing in MotionX)
4. Go home and dump the pictures from your camera into a folder.
5. Fire up a command window and change into the directory where you pictures are.
6. Run the perl script. Here is the command I used:

./gpsPhoto.pl --dir geotag --gpsfile Track.gpx --timeoffset 21600

There are a ton of options that you can use, but these 3 should get you by. The first two args are pretty self explanatory, but the third isn't at first. The timeoffset is the UTC offset in your timezone in seconds. I live in Denver, and my offset is 7 hours, minus 1 hour since we are on daylight savings. Just google the local time in your city if you don't know what your offset is, and then multiply that by 60 minutes and 60 seconds.

Anyway, this should get you started, and I was able to get this to work on Windows, Mac OSX, and Ubuntu, so you should be able to follow my instructions on any OS that supports perl. Lastly, you can use any old GPS to get the GPX file, it's just a matter of having your GPS with you as well as the ease of getting the GPX file to your computer.