Wednesday, July 16, 2008, 9:11pm
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
doneSo my workflow is now:
- Copy photos from memory card to temporary directory on my harddrive along with GPS log
- Use HoudahGeo to tag each image with longitude, latitude and altitude, along with the city/state and country
- Save the GPS log away in case I need it later
- Run the Automator script on the images to fix the city/state issue (installing it as a Finder plugin is recommended)
- Import the images into Aperture
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.
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.
t should however be noted
t 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.
You have very great knowledge
You have very great knowledge having this subject.