Adding tags from a GPX file to your photos (Geotagging)

GPS is the gratest thing after digital cameraes in my opinion. So how do you geotag (get the GPS information into the EXIF of your photos) photos after they have been taken?

You will need a device that can generate a GPX file and you will need a digital camera. If you read this you probably allready have a digital camera, so I will jump right to the tagging section.

I use my cellular phone (a Nokia N78 and nokia’s SportsTracker http://sportstracker.nokia.com/) to generate the GPX file. I start the application when i go on a tour and export a GPX file when done.
REMEMBER: Before starting any tour; syncronize the time and date of your device (in my case the Nokia N78) and camera.

When your photos are geotagged this will be recognized by sites like flickr.com

How to set GPS information into your photos

I assume that you have a GPX file (the definition of a GPX file is available here: http://www.topografix.com/gpx_manual.asp) and some photos. The photos and the GPX sampling device MUST be set at the same local time, forget about UTC (Universal Time Converter) as EXIF (the camera time) does not support UTC.

This guide will work for computers using Windows XP and Vista (tested on both), and it should work on Mac and Linux with modifications.

Installation of required applications

This guide should only be done once.

Install a Perl language interpreter. A freeware version can be located at http://www.activestate.com/activeperl/. Install the PERL istallation using the default options. Default installation path is c:\perl.

Notice: The ActiveState Perl installation will install itself into the PATH invironment variable on your computer. I will assume that you have not disabled this feature in the installer (it is on by default)

Download gpsPhoto from http://www.carto.net/projects/photoTools/gpsPhoto/. select the link “Direct download of gpsPhoto.pl (HEAD)” and right-click and save target as gpsPhoto.pl (this is a downright stupid way of organising their website, but they write good software so should we not forgive them?).

Copy the gpsPhoto.pl file to C:\Perl\bin

You are now ready to geotag your photos using the GPX file.

Geotagging your photos

Now we will go down to the fun business. The thing that really matters; geotagging the photos.

place your image files in a folder of your choice

place the GPX file in the same folder as the image files.

Create a new file ANYTHING.bat in the same folder as the imagefiles and open the BAT file for edit. Write the following in the file: gpsphoto.pl –gpsfile komplet.gpx –overwrite-geotagged –timeoffset 0 –maxtimediff 7200 –dir ./

komplet.gpx is the name of the GPX file. This is the GPX file you saved using your GPS device. Any filename will go here; even filenames that does not include the GPX extension.

–overwrite-geotagged means that the original file should be overwritten with the resulting geotagged file.

–timeoffset 0 means that there are no time differences between the image DateTimeOriginal exif timestamp and the GPX file time stamp. This can be changed from ’0′ if camera and GPS device time was not in sync at the time of capture.

–maxtimediff 7200 means that an image is considered to be taken at the same spot as the closest (time wise) GPS position within 7200 seconds (2 hours). Images that were taken with more that 2 hours to any GPS position will NOT be geotagged.
The 7200 can be changed to any value.

–dir ./ means that the images to be geotagged is located in the same folder as BAT file. Save the BAT file.

Save the BAT file

Insert a ‘pause’ on a new line in the BAT file. This will pause the execution of the BAT file when the geotagging is done. This way you can see the information output by gpsphoto.

Run the BAT file we just created (double-click it) and let gpsphoto and ExifTool do their work.

Hopefully you will see a message in the button of your console window stating “Found coordinates for XX images out of XX images … done.” this means that the photos has all been geotagged. otherwise you should control the timestamps of the GPX file and the image files for a start.