iPhone re-Geotagging

2 September 2008 at 0:21 (Uncategorized)

The iPhone 3G’s ability to geotag photos out of the box was a major draw card for me. Unfortunately, there’s something awry with the way geotagged photos are being handled in OS X.  At the moment whether you import photos through iPhoto, Preview or using Image Capture, at some point the GPS reference may get set to North/West. This is a problem if you live outside of the North-Western hemisphere.

Regardless of whether Apple fixes this, you’re still going to have to retag all of your old photos. So a few weeks ago I wrote a script to automate the process.

This applescript can either be set as the Automatic Task in the ImageCapture utility or you can drag files onto the script for processing. However, first you’ll need to install Phil Harvey’s exiftool: http://www.sno.phy.queensu.ca/~phil/exiftool/

Then copy and paste the code below into Script Editor, customise for your location if you’re not in the south & east hemisphere and save as an application (eg. File Format: Application). I’ve #commented the code to help you find where to tweak the North/South/East/West variables.

(* This script can either be set as the Automatic Task in the ImageCapture utility or you can drag files onto the script for processing.  
  
FIRST: the script checks each file to see if it's been geotagged (otherwise screenshots and saved images that are in your camera roll end up getting tagged with the coordinates 0,0)  
SECOND: it changes the reference data on any images that hold an unwanted compass point (eg. North) to the desired reference points (eg. South & East) *)

on open theFiles
	repeat with aFile in theFiles
		#this next bit searches for files that are inappropriately tagged GPSLatitudeRef = N (eg. North)  
		#however, depending on where you are, you may want to change it to search for files tagged West (eg. Ref = W)  
		do shell script "if (exiftool -v " & quoted form of POSIX path of aFile & " | grep \"GPSLatitudeRef = N\"); 
		#Change the =S and =E to the desired compass refernces. (South & East are good for Oceania)  
		then exiftool -overwrite_original_in_place -gpslatituderef=S -gpslongituderef=E " & quoted form of POSIX path of aFile & "
		fi"
	end repeat
end open


(* As far as I know this works, however I take no responsibility for any loss/gain of data which results from the use of these 1's and 0's. Please share if you see anyway that this script could be improved. *) 
Advertisements

4 Comments

  1. On the top of the world and proud of it said,

    Good on you for fixing yet another outstanding piece of North American egotism.

    If anyone is uncertain, West/East refers to where the prime meridian is in relation to you (the shorter distance). The prime meridian runs through London and central west Africa. North and South America, most of west Africa, Spain, the British isles, and part of western France is “West”; the rest of the inhabited world is “East”.

  2. Climate change hasn't drowned them yet, so... said,

    Most islands in the Pacific are “West” as well.

  3. monototo said,

    yeah, I thought about making scripts for the people in the other hemispheres, or you know, using some variables… but I got lazy.

    perhaps it’s not just the North Americans who are egotistic.

  4. Bookmarks about Geotag said,

    […] – bookmarked by 5 members originally found by sfick on 2008-12-17 iPhone re-Geotagging https://monototo.wordpress.com/2008/09/02/iphone-re-geotagging/ – bookmarked by 4 members […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: