Action Geotag

(New in Phatch 0.2)

What this does and how it works


The purpose of this action is to add GeoTags (exif location tags) to your photographs. The action reads a GPX file which contains time and location data. The action uses the image's exif timestamp and looks in the GPX to obtain the location of the photo. The exif data in the source image is updated.


GPS Data

A GPX file contains position information taken from a GPS device. I obtain this from my Garmin Forerunner using GpsBabel. Here's my 'readgps' script which writes the GPX to stdout:

# read from the garmin to stdout
gpsbabel -w -t -r -i garmin -f usb: -o gpx -F - $*


This is the number of seconds between GPX time (UTC) and local time on the camera's clock. (exif tag 'Exif.Image.DateTime') Positive if you are west of GMT. So for me in San Jose, CA during summer this is 7 hours or 25200 seconds.

I find it helpful to think of Timeshift relative to the sun. During daylight saving time, we move our clocks east (towards the rising sun). PST (Pacific Standard Time) is 8 hours (28800 seconds) PDT (Pacific Daylight Saving Time) is 7 hours (25200 seconds). If the camera is FAST, subtract seconds from Timeshift. You can think of daylight saving as everybody setting their watch 1 hour FAST. And a FAST clock means you've moved your camera towards the sun (so subtract from Timeshift).

If you live in the eastern hemisphere, you'll have a negative timeshift. However you'll still subtract for daylight saving or your watch being fast.

GPS Report

This is a short report (in csv format) which documents the processing done by the action. This can be opened by any spreadsheet program such as OpenOffice or Gnumeric.


camera time,nearest gps,latitude,longitude,elev,photofile
2009-06-06T17:26:37Z,2009-06-06T17:27:15Z,37.20'33"N,121.53'39"W,   9.3,/Users/rmills/temp/test/DSC04960.jpg
2009-06-06T17:31:21Z,2009-06-06T17:31:22Z,37.20'22"N,121.53'29"W,  27.1,/Users/rmills/temp/test/DSC04962.jpg
2009-06-06T17:32:27Z,2009-06-06T17:32:30Z,37.20'18"N,121.53'29"W,  22.7,/Users/rmills/temp/test/DSC04964.jpg
2009-06-06T17:34:11Z,2009-06-06T17:34:15Z,37.20'17"N,121.53'26"W,  21.3,/Users/rmills/temp/test/DSC04966.jpg
2009-06-06T17:35:13Z,2009-06-06T17:35:18Z,37.20'19"N,121.53'23"W,   0.1,/Users/rmills/temp/test/DSC04967.jpg


If you want to save only the geodata without altering the image, choose the Save Metadata action instead of a normal Save.

About this action

There's a lot more information about the implementation of this action at:

© 2007-2008
(It is not allowed to copy, distribute or transmit any part of the wiki without written permission.
Only contribute to this wiki if you agree with this term.)