Snow Leopard Services to Geotag iPhoto Images

In one of the updates to iPhoto 8, Apple added the capability to use Applescript to geotag photos – that is, embed latitude, longitude, altitude, and other geographic information. Adam Burt noticed this update and suggested a simple Applescript to geotag a photo with a specific latitude and longitude (see here).

It's quite simple to go from his script to a simple service in Snow Leopard. But first, why on earth would I want to do that? I'm keen on embedding as much metadata in my photos as possible, including location. However, it can be a pain to set a specific site over and over. An example of this problem is my home. Every photo shot at my house should be geotagged with that location, but making sure all the photos are properly set is difficult.

Now, imagine a service that I can select from a menu (or key combination) that would set the geotag for every selected photo in iPhoto to the coordinates of my house?

To create the service, open automator and create a service.

Set the service to recieve no input from iPhoto.

Add the “Get Selected iPhoto Photos” action to the workflow. (this might not be required, however)

Add a run Applescript action.

Set the code to look something like this:

on run {input, parameters}
 tell application "iPhoto"
   set mySelection to selection
   repeat with myImage in mySelection
     tell myImage
       set longitude of myImage to -10.0
       set latitude of myImage to 10.0
       reverse geocode myImage
     end tell
   end repeat
 end tell
 return input
end run

Now you can have several services set to specific locations you commonly use.

Thanks again to Adam Burt for the tip!

Leave a Reply