May 01, 2016

Geotagging like it's 2016

Last time I dabbled in the art of geotagging was back in 2008 when I wrote about it here. It was quite a laborious task back then with having to manually specify on a map where a photo was taken #nothanks

Thankfully things have moved on slightly since then and smartphones and some digital cameras (the rugged/outdoorsy type) automatically add locale information into each shot utilizing built-in GPS devices. However more often than not, high-end cameras do not have this capability.

Hiking anyone?
I have this thing whereby I do something, like it and go all out and buy the kit. Thankfully eBay is at hand so I don’t need to pay full price for some of my techno geek gadgets that I "need" (helps settle that internal struggle of wanting all things beepy and squeaky versus the do I really need it question).

Anyway bought a mint condition Garmin eTrex 10 on eBay for around 60 bucks. These are very capable GPS units creating accurate track logs in GPX format.

So off on my hike I went, a track log being created as I walked (think Hansel and Gretel and those bread crumbs), taking random snaps with my camera along the way. At the end of it I was left with a bunch of photos and a GPX track file.

Off-topic but I toyed with the idea of getting a GPS device with maps built in but you really don’t need to; learn how to navigate using a grid reference system. Many GPS units like the eTrex 10 can be switched to display grid units compatible with a physical map instead of longitude and latitude coordinates.

It’s all about the metadata 
It’s certainly not all about you! That selfie you just took doesn't just contain your ugly mugshot beautiful you! A modern camera/smartphone will also capture a bunch of other stuff and include it in the image including when the photo was taken, make/model of camera used, whether or not the the flash was on, image orientation, etc. and if it is a GPS-enabled device (and has a signal), where the photo was taken #scary

That "stuff" (technical term for metadata) is stored in a standard format known Exchangeable image file format or Exif within the image file itself and can be manipulated without interfering with the actual image.

Hello Exiftool!
There’s a bunch of software out there that can manipulate an image’s metadata including where the photo was taken. Exiftool is one of them and it’s free and open source. In fact some of the paid software I’ve seen such as HoudahGeo bolt onto this tool so if you already have a GPX track, why do you need to pay for such tools (yep, you don’t!)

Exiftool can read in a GPX track file and based on the time and date of a photo, it can determine where on the track it was taken and update the image's metadata with its locale information accordingly.

With Exiftool installed on my Mac and the GPX track file (named mytrack.gpx) and photos in the same folder, I can execute the following to geotag my photos:
exiftool -P -geotag mytrack.gpx .
If the camera’s clock was set to a different timezone, use the geotime tag to specify that. I took my camera to the UK and had the camera time set to GMT (UTC+0). The following worked for me to geotag my photos once I returned:
exiftool -P -geotag mytrack.gpx '-geotime<${DateTimeOriginal}+00:00' .
For more information on geotagging with Exiftool see http://cpansearch.perl.org/src/EXIFTOOL/Image-ExifTool-9.90/html/geotag.html

Top Tip #1: Yep it’s therefore imperative ideal that the camera’s date and time is up to date. If this is not the case, then you probably want to fix this first. Good luck with that! Ha. Seriously, you can use Exiftool for that too. By the same token, the date and time on your GPS device should also have been set correctly when the track was recorded.

Top Tip #2: While Exiftool won't overwrite your original photos (at least by default), it will append _original to the filename and it’s rather annoying in case you need to do a quick restore. I therefore suggest you make a quick copy the entire set of images/image folder first.