Aperture & Google Earth

ComputingPhotographyGPS

You have photos in Aperture that have GeoTags in their EXIF data and you’d like to view these locations in Google Earth?

Here is an AppleScript to do it :

    on run
      tell application "Aperture"
        set theSelection to selection
        set theImage to item 1 of theSelection -- get the first selected image
        try -- there might not be geotags in the photo
          set lat to value of EXIF tag "Latitude" of theImage -- get the latitude
          set lon to value of EXIF tag "Longitude" of theImage -- get the longitude
          tell application "System Events" -- find out if Google Earth is running
            set isRunningGE to (name of processes) contains "Google Earth"
          end tell
          if isRunningGE then -- only do this if GE is running, it is such a hog at startup
            tell application "Google Earth" -- switch to Google Earth
              activate -- bring Google Earth to the front
              set viewInfo to GetViewInfo -- get the current view
              set latitude of viewInfo to lat -- set the new latitude and longitude
              set longitude of viewInfo to -lon -- bug in Aperture 1.5.n, reverses the Longitude
              SetViewInfo viewInfo -- go to the new view
            end tell
         else
           display dialog "Launch Google Earth first please" with title "Show on Google Earth" buttons {"OK"} with icon stop
         end if
       end try
      end tell
    end run

Save this as a script called “Show on Google Earth” in ~/Library/Scripts. Enable the Scripts Menu (if necessary) using /Applications/AppleScript/AppleScript Utility.app. Select a photo (with Lat/Lon) in Aperture. Select the script from the Scripts Menu.

Google Earth needs to be launched first.

Enjoy.