Using Google Earth to geotag photos in Aperture 3

After a couple of years of painful attempts to geotag all my photos, I've finally got something that might end up working: a small hack that grabs the current location from Google Earth and updates the selected images within Aperture (3.1). This post explains it, and how to install it.

Sorry, but you're going to have to suffer a bit of a rant first:

This whole effort comes from my deep hatred of the Places feature in iPhoto '11 and Aperture 3. While I'm not a particularly good photographer, I do try to keep all my metadata neatly arranged and all my photos neatly geotagged. However, until recently, iPhoto hasn't even tried to make this possible. Instead, I'd geolocate the photo using a mixture of Google Earth and Flickr's map, and then try to copy those locations back to iPhoto with varying results. I started using bits of Perl and AppleScript, including a horrible kludge to construct a lookup table in SQLite between Flickr's metadata and iPhoto's catalogue and then use ExifTool to reapply the latitude/longitude data.

Incidentally, since then, I've found the promising PictSync app being written by Loghound. It promises to eliminate the need to hacked-up scripts to do the Flickr-to-iPhoto metadata sync. It's a bit rough around the edges at the moment, but it's getting better by the day.

However, even with PictSync, this approach only works for the 5-10% of photos I chose to upload to Flickr. The lion's share of my 10,000-odd photos were untagged.

iPhoto '11 looked like it was going to sort all this out: the heralded Places feature looked easy, and even "fun". So, I made a special trip out to the Apple Store to buy iLife '11 when it was released. Unfortunately, in my opinion, Places has a terrible UI: it's buggy and poorly documented, and even when it does what it's meant to do it's difficult to use. You can see what they were trying to achieve and it's usable if all you're trying to do is locate a single image at a well-known Googleable location in the US, but it's a cow for everywhere else.

I finally cracked when I was trying to tag a 2002 business trip I took to Malmö, Sweden. I managed to find all the locations, but getting these onto the photos with Places is a nightmare: the only reliable method I've found is to convert all the locations to latitude and longitude in a text file, and then one-by-one, apply the location, resulting in a pointless Google lookup and a usually-wrong reverse geolocation.

Anyway, when the Mac App Store was launched this week, I cracked and paid the heavily-discounted £45 for Aperture 3, as I just can't stand using iPhoto '11 anymore. Anything's better than iPhoto '11... even iPhoto '09.

Unfortunately, Aperture 3 contains a version of Places that's obviously using a lot of the same code as the iPhoto '11 version. It's broken. It's badly documented. It's got an incredibly frustrating feature where clicking an unlocated photo in Places will result in losing the current map location and showing the world instead: exactly the opposite of what you want when you're trying to label a set of photos one-by-one.

I tried some third-party plug-ins such as Maperture Pro from Übermind, which is a darn sight better than Places' interface for positioning photos, but it has a few UI problems of it's own: not least of which is the modal nature of the dialog box that stops the ability to zoom in on the image in question, making it hard to locate. As a result, you have to be sure of the location before you browse. Anyway, it's still not ideal, especially since I need to be able to browse Google Earth for the area, community labels and street view to be sure of where the photo is.

So, I think a possible way to solve this is to use Google Earth as the geotagging interface. I couldn't find an existing plug-in to do this, so I fired up Automator and tried to remember how to use AppleScript (again). The result is a small ".workflow" file that you can install as a Service, and then trigger from either Aperture or Google Earth.

To install:

  1. Download this archive file containing the workflow
  2. Uncompress it into a .workflow by double-clicking it (if your browser hasn't already done so)
  3. Move it into the Services subfolder of your user's Library folder; OR you can double-click it to load it into Automator and then save it as a service. It should then be installed automatically.
  4. Launch System Preferences and select the Keyboard Shortcuts tab of the Keyboard preference pane
  5. Use the "+" button to add a new Application Shortcut
  6. Choose Aperture.app as the application
  7. For the menu item, type Set Aperture GPS from Google Earth exactly. It must be exact or the shortcut will not work.
  8. Choose a keyboard shortcut: I use Cmd-G, which seems to be free in Aperture 3.1 and in Google Earth
  9. Add another identical Application Shortcut, but with Google Earth.app as the application.

CAUTION: I HAVE NOT DONE MUCH (IF ANY TESTING) ON THIS UTILITY. USE AT YOUR OWN RISK. BACKUP YOUR APERTURE LIBRARY BEFORE ATTEMPTING TO USE IT.

To use, select one or more photos in Aperture, find the location for the photos in Google Earth, and hit the keyboard shortcut you chose. By adding two shortcuts, you can activate it from either app. Alternatively, you can go to the Services menu in either app and choose the workflow there.

In addition, I found a KMZ file that adds crosshairs to Google Earth by Jeffrey Friedl which makes the geotagging a bit more precise.

The script doesn't include any error checking -- or much of anything, really -- but you're welcome to use it, and even improve it if you like. If you do improve it, please let me and other readers know using the Comments section below.

Here's to Steve Jobs actually spending more than five minutes trying to geotag some of his old photos with Aperture and realising how much it sucks!

UPDATE: Here's a workflow that does the reverse and displays the location of the current Aperture selection (just the first image) in Google Earth: View_Aperture_selection_GPS_in_Google_Earth.workflow-r1054.tgz. It's useful to take an existing image as a basis and adapt the location from there. Use the same instructions as above to install it.

Tags

8 comments on “Using Google Earth to geotag photos in Aperture 3

  1. Hi Tom,

    I do not know which camera you have. Maybe you will find a solution here:

    http://www.gps-camera.eu/wissen/29-hardware/276-liste-aller-kameras-mit-gps-schnittstelle.html
    (Use google translate at top right of the page for English)

    http://www.gps-camera.eu/component/jtags/Mac/?lang=de brings you a lot of ideas how to use Geotagging on Mac OS X

    Cheers!

  2. Wow, thanks for this... exactly what I was searching for. Places drives me crazy! The Places map is buggy, overly sensitive, and just unresponsive at times. You just made my night!

  3. Tom,

    I have been debating parsing the .kml file from GE and using the resultant place name and lat/long to write to Exif. I have to think that this approach has been done before. It is along the same lines as your approach, so thought I\'d shoot you aline. Thoughts?

    -Chris

  4. Chris,

    Sounds like a good idea... we\'ve all got several different parts to our photo workflow: iPhoto/Aperture, our online albums eg. Flickr, the camera, the phone camera, the tablet, Google Earth, etc. Which particular direction to choose seems more personal taste than anything, which is why a \"do-it-all\" application is unlikely to fit anyone\'s needs very well.

    Two things it seems to be worth getting a grip on is filenames (as they are not unique, considering how often cameras are replaced), and timestamps/timezones. Getting your head round the issues involved seems to be a vital part of getting this kind of script to work right.

    The best tip I got on this matter was to leave my camera permanently on UTC/GMT, rather than local time, as EXIF doesn\'t have a field for timezone. It makes life easier when cataloguing, and as long as you have the location, you can deduce local time from there. Unfortunately, iPhone pics are then tagged with local time without any timezone offset identifier. As a result, it\'s a pig to get the photos in the right order.

    I\'ve had trouble with EXIF being preserved before, so personally I prefer to \"master\" the information in one place (Aperture, in my case) and then push it out from there. One neat thing I have done is to read in the ApertureData.xml file (actually a plist) and generate a KML file from there. It produces quite a nice KML file with pictures grouped by location.

    If you\'re interested, the code\'s here, but it\'s a messy hack job: http://gidden.net/svn/misc_scripts/ApertureToKML.m

    Incidentally, I treated myself to a 3DConnexion SpaceNavigator I saw cheap on eBay last year... it makes geotagging photos in Google Earth much quicker and a lot of fun... highly recommended if you can find one cheap.

    Let me know how you get on!

    Regards,
    Tom

  5. Tom,

    Good thoughts, appreciate (am a noob with this).

    What I ultimately want to achieve is a library of photos with purely embedded metadata, not requiring a master file. I am a very recent convert to iMac, and admit to being initially wowed by the presentation and subsequently disappointed with iPhoto\'s treatment of metadata. As a noob, the hazard of metadata being stripped is an item I am aware of, but have not yet experienced...a bit of a letdown that. I\'ll keep you posted as to developments, but I like this scripting approach quite a lot, I just have to figure out how to make it match my metaphor.

    -Chris

  6. I do think the embedded metadata idea is a good one... it hasn\'t worked very well for my particular approach, but you might have a different experience of it. I think part of the problem is that I use RAW (well, CR2) files almost exclusively now, and that adds a bit more complexity.

    One thing I do want to make sure of is that I preserve a definite way to identify the photo, so that if/when software changes, I can be sure that I can preserve the metadata. I have a separate backup of the geolocations of the photos as a text file, just in case Aperture manages to foul it up!

    I\'m tempted to assign a UUID to every single photo and make sure that link is maintained in EXIF, Aperture\'s DB, Flickr\'s metadata, Google Earth, SQLite backup, etc.

  7. You, sir, are a genius! THANKS! I wish I\'d found this a year ago.

    It\'s working fine for me with Lion and Aperture 3. I use the Geotagger app (shareware) with Google Earth to geotag all my new photos (into their EXIF metadata) before adding them to Aperture. Why? Because I was, and remain, bamboozled by how to quickly assign precise lat-long co-ordinates to photos inside Aperture. With your clever (and surprisingly simple) Applescript, I can now apply the same Google Earth approach to my old photos already in Aperture. Great!

    I remain baffled by why Aperture does this so very badly on its own.

  8. Tom,

    Thanks a lot for this workflow. I fully share your hate for the places function in both iPhoto and Aperture. It is one of the very poorly implemented features of these apps.

    Until this morning I was using the excellent Geotagger utility (http://craig.stanton.net.nz/code/geotagger/), which essentially does the same thing as your script. Unfortunately for some odd reason it stopped working, after years of good service.

    I am now using your script, which I have modified for use for iPhoto. I do not use a shortcut. Rather I select the script from the services menu.

    Thanks a lot for the help!

    M

Leave a Reply

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

*

HTML tags are not allowed.