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.

A lot of this guide has been taken from the guide at http://marc.merlins.org/linux/gps_geotagging/, my respects to the author

Installation of required applications

This guide should only be done once.

  1. 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.
    1. 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)
  2. Download Exiftool from http://www.sno.phy.queensu.ca/~phil/exiftool/index.html
    1. copy all files in the “lib” directory to C:\Perl\site\lib
    2. Copy “exiftool” to C:\Perl\bin and rename this file to “exiftool.pl”
  3. 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?).
    1. 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.

  1. place your image files in a folder of your choice
  2. place the GPX file in the same folder as the image files.
  3. 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 ./
    1. 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.
    2. –overwrite-geotagged means that the original file should be overwritten with the resulting geotagged file.
    3. –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.
    4. –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.
    5. –dir ./ means that the images to be geotagged is located in the same folder as BAT file. Save the BAT file.
  4. Save the BAT file
  5. 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.
  6. 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.

This entry was posted in EXIF, GPS, Photo, Programming and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>