brianpuccio.net

it's dot com

Fixing HoudahGeo's City And State Reverse Geocoding

Date: Wednesday, July 16, 2008 - 9:11pm
Keywords: me, photography, Aperture, IPTC, Automator, metadata, geotagging, houdahgeo, exiftool
Links: 236 reads

I've been looking into geotagging my photos and finally got around to purchasing a GPS logger. Initially, I just wanted a script to automate the merging of the latitude and longitude from the GPS log into each image's EXIF information, after which, I'd just import the images into Aperture as normal. But then I found out that even more useful would be to reverse geocode the images. This would mean the the IPTC fields for city, state and country would be automatically populated, saving me from the task of manually entering each in Aperture.

Well, HoudahGeo does it better and more elegantly than any other software out there. After downloading a demo and reading Brett Gross' write-up on Aperture and houdahGeo I was sold.

The one glitch is that HoudahGeo saves both the city and the state into the IPTC city field, separated by a comma and a space, e.g., Great River, New York. I sent an email to the developers and was told that the next version, 1.5, would have this fix. Until then, I've whipped up an Automator workflow with a bit of bash scripting that calls exiftool that splits the IPTC metadata properly and will work with cities and states with any characters, including spaces, but not commas. Here's the guts to the Split IPTC City And State Automator Script:

# This automator workflow is licensed under the GPL, v2
for f in "$@"
do
        CITYSTATE=`exiftool -City -s -s -s $f`
        CITY=${CITYSTATE%,*}
        STATE=${CITYSTATE#*, }
        exiftool -overwrite_original -City="$CITY" -Province-State="$STATE" $f
done

So my workflow is now:

  1. Copy photos from memory card to temporary directory on my harddrive along with GPS log
  2. Use HoudahGeo to tag each image with longitude, latitude and altitude, along with the city/state and country
  3. Save the GPS log away in case I need it later
  4. Run the Automator script on the images to fix the city/state issue (installing it as a Finder plugin is recommended)
  5. Import the images into Aperture

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thanks for posting this!

Hi!

I am the author of HoudahGeo. I hope your script will be of help to some of our customers.

It should however be noted that the reason why HoudahGeo merges the two informations into one field is that from its data source it does not know which of the two values represent the city. It can just as well receive the values "Westwood" and "Los Angeles" where obviously neither is the state.

Thus I invite you to first check your photos to see what the granularity of information of for your area before running this script.

Best,
Pierre Bernard
Houdah Software s.à r.l.

reply

Uh Oh

I've reverse geocoded several hundred photos already and they consistently were tagged city, state, so I guess I got lucky. Thanks for the information Pierre, I'll update this script as I come across more variants.

reply

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <blockquote> <img> <h1> <h2> <h3> <h4> <del> <ins>
  • Lines and paragraphs break automatically.

More information about formatting options

Recent Photos

I've got several hundred photos offline that I've been meaning to upload, just never got around to it.

  • Adam Savage At HOPE
  • Adam Savage Talks About His Dodo (And His OCD) At HOPE
  • Adam Savage At HOPE
  • Kevin Mitnick Shows Us How To Unmask Blocked Caller IDs At HOPE
  • Kevin Mitnick At HOPE
  • Kevin Mitnick At HOPE
  • Kevin Mitnick At HOPE
  • Kevin Mitnick At HOPE
  • Kevin Mitnick And Emmanuel Goldstein At HOPE
  • Kevin Mitnick And Emmanuel Goldstein At HOPE
  • Kevin Mitnick And Emmanuel Goldstein At HOPE
  • Steven Rambam, PI, Talks About Privacy And How You Have None At HOPE
  • Algormor Shows Off Bagcam Footage At HOPE
  • Ray Beckerman Discuesses Ways To Fight Back Against The RIAA At HOPE
  • RenderMan Discuss Wireless Vulnerabilites At HOPE
  • Gillian Andrews Talks About OLPC At HOPE
  • Phil Lapsley Discusses FOIA At HOPE
  • Virgirl Griffith Shows Off WikiiWatcher 2 At HOPE To A Standing Room Only Crowd
  • Virgirl Griffith Shows Off WikiiWatcher 2 At HOPE
  • Virgirl Griffith Shows Off WikiiWatcher 2 At HOPE

Recent Blogs

Recent Excerpts

User login