h1

Geotagging for DSLR users

June 18, 2009

There are masses of geotagged photos in cyberspace nowadays, by which I mean jpegs with location information (latitude, longitude) included in the embedded EXIF data. It’s all thanks to the popularity of the iPhone with its camera, built-in GPS unit and ready connection to the Internet. Social networking sites and interaction with on-line map services such as Google Maps all help to fuel the fun.

The geotag bonanza is not limited to iPhone users. Modern Windows Mobile phones and other platforms all have the same capability, if not the surrounding hype. And we are starting to see GPS units incorporated into point and shoot cameras, for example the Nikon Coolpix P6000 which geotags pictures automatically before they ever leave the camera.

But what about DSLR users? When do we get in-camera GPS? And why would we want it?

I for one don’t see it as a gimmick. For people who take a lot of photos on their travels it can be hard to keep track of exactly where you took every photo. It’s not as if the Eiffel Tower will be in every shot. For example, I took the picture below on a Far East cruise two years ago. I shot this from the deck of the ship as it was making its way from Nagasaki to Osaka, meandering around the Japanese islands.

I was fascinated and bemused by the unexpected sight of a mock-up of Venice. I’d love to know what it was all about and where this was. But I don’t have the details of the route the ship took, so my chances of finding out are probably slim.

GPS-enabling DSLRs would be such an obviously useful thing, but as of today there are none. The closest we have come to it is Nikon’s GP-1. This is a stand-alone GPS unit which attaches to the hot-shoe of the D90 D3, D300, and D700 cameras and adds automatic geotagging of photos. Nothing at all yet for Canon, Sony et al. So what to do?

Purpose-built geologging devices

Well there are dedicated devices for geologging, that is keeping a log of your geographical position by taking regular GPS readings and writing them to a file, along with a corresponding timestamp. The idea is you later use suitable software to match the photos to the location data, by reference to their respective timestamps, and the EXIF data updated to include the geotag. There are also fancy geologging devices which accept an SD card with your photos on it and add the geotags automatically. But such wonders do not come cheap. This one from ATP is about $90.

Windows Mobile phone used as geologging device

I wondered whether I could do the whole thing for free by using the GPS unit built into my Windows Mobile phone, instead of buying a dedicated geologger. My phone (HTC TyTN II) certainly includes GPS in the spec, but did not come with any satellite navigation software and I had never bothered with any, so the GPS unit had probably never even had juice through it. Still, maybe it had not totally atrophied from months of being ignored.

I hit upon a free application, GPSToday, which is essentially a clone of the Google map application for mobile phones. Crucially it has a geologging function. You can set it going and, as you walk around, every 30 seconds it writes your location to a file. You can change the frequency of readings or let it vary it “intelligently”. I guess that means it takes more readings when you are moving about more.

This sounded desperately promising, so I installed it and got it working. It works perfectly, happily latches onto legions of satellites when you are out and about, and on request records your travels in a text file (I elected to call it geolog.txt) in the following format:

time,latitude,longitude,altitude (feet),speed (mph),heading
06-16-2009 17:14:48,34.361445,21.317156,440,0,0
06-16-2009 17:14:59,34.361486,21.317144,407,0,0
06-16-2009 17:15:10,34.361502,21.317144,404,0,0

That’s the first snag. It’s just a flat file, not in any recognised format for location data such as GPX or NMEA. How could I expect it to be recognised by any suitable photo geotagging software? GPSToday assure us that a future version will output in GPX format, but for now we’re stuck with the existing non-standard format.

Getting the location data in a recognised format

Enter GPSBabel, a free software application that translates location information between a myriad of formats (including all the proprietary SATNAV manufacturer systems) and even “custom” formats such as the one used by GPSToday. Mind you, it is hardly straightforward. You have to use the “xcsv” mode and create a “style file” to tell GPSBabel how to interpret the non-standard location data.

This is how I did it. I created a folder on my C: drive called GPSBabel and in there put all the files downloaded from the GPSBabel site. I also copied the location data file geolog.txt from my phone to the GPSBabel folder. I then created a text file called GPSToday.txt, in the same folder, into which I inserted the folowing text:

# Format: GPStoday

DESCRIPTION GPStoday
EXTENSION txt

#
# FILE LAYOUT DEFINITIIONS:
#
FIELD_DELIMITER COMMA
RECORD_DELIMITER NEWLINE

PROLOGUE time,latitude,longitude,altitude (feet),speed (mph),heading
IFIELD ISO_TIME,””,”%s” # time
IFIELD LAT_DECIMAL, “”, “%f” # Latitude
IFIELD LON_DECIMAL, “”, “%f” # Longitude
IFIELD ALT_FEET,””,”%.0f” # altitude
PATH_SPEED_MPH,””,”%.1f” # speed
PATH_COURSE,””,”%f” # heading

I saved it and changed the extension to .style so the file became GPSToday.style.

Now I should explain that I did not arrive at that style file at the first attempt. Most of it wasn’t too bad but the time field setting was a nightmare. I tried just about all the options in the GPSBabel help system and none worked. GPSBabel could not understand the date/time data in the format output by GPSToday, no matter what I did.

In the end I decided to use the ISO_TIME option and run a script to rearrange the date/time information into a format that would be understood by GPSBabel in conjunction with the ISO_TIME setting. In practice, this meant writing a bit of Visual Basic code. For convenience I did this from Excel.

This is the code:

Sub FixTime()

Dim TextLine As String
Dim LineBuffer As String

Open “C:\GPSBabel\geolog.txt” For Input As #1
Open “C:\GPSBabel\geologISOTIME.txt” For Output As #2

Line Input #1, TextLine
Print #2, TextLine

Do While Not EOF(1)
Line Input #1, TextLine

LineBuffer = “”
LineBuffer = LineBuffer & Mid$(TextLine, 7, 4) & “-”
LineBuffer = LineBuffer & Mid$(TextLine, 1, 2) & “-”
LineBuffer = LineBuffer & Mid$(TextLine, 4, 2) & “T”
LineBuffer = LineBuffer & Mid$(TextLine, 12, 8) & “Z”
LineBuffer = LineBuffer & Mid$(TextLine, 20)

Print #2, LineBuffer

Loop

Close #1
Close #2

End Sub

On running this VB macro, a new file, geologISOTIME.txt is created in the same folder, with the same data as geolog.txt but with the date/time format changed so that it would be acceptable to GPSBabel.

You can then run GPSBabel, by double clicking the file GPSBabelGUI.exe. You have to point it at the input file, geologISOTIME.txt, and specify that it is in xcsv format and also specify the style file, GPSToday.style. Give the output file name as say geolog.gpx and specify the gpx output format. Then run the translation process to get your location data into a standards compliant format you can use with a photo geotagging program.

Applying the geotags

The final step is to feed both the gpx file and your photos to a program which can do the timestamp matching and write the geotags to the photo files. I picked a free open source program called GPicSync.

It is fairly self explanatory in use. If you managed to cope with the format conversions then running it will not be too taxing. It creates new versions of your photos, with the geotags written into the EXIF data, and saves the untouched originals in a backup folder. Job done.

Proving the geotagging has actually worked

As an independent check I downloaded Microsoft’s Pro Photo Tools 2 suite, again free. If you open one of your geotagged photos in that application you can use the built-in map function to locate where the geotag is saying the picture was taken.

I did that and was amazed to find that my pictures were all correctly geotagged. Having done the hard work I now have a proven workflow for geotagging photos taken with my DSLR, and it did not cost me a penny.

Using the geotagging solution in practice

It’s simply a matter of making sure you take your phone on your photo trips and the geologging function is in operation from before you take the first picture in a batch, and until after the last picture in the batch. You can keep starting and stopping the logging function. You don’t have to change the logging file name, GPSToday just appends new time/location records without overwriting.

It is important to make sure the GPS is logged in to some satellites before starting shooting. Best to turn the GPS on in persistent mode (see GPSToday help) and just leave it on for the day. And check periodically it is still locked on. You don’t want to be caught out by finding the GPS is off or not latched onto a healthy bunch of satellites as you are about to start taking pictures.

One important point: time zone. The workflow will only work if the timestamps on the photos and the phone are in sync. Make sure, particularly if you are travelling abroad, that the time settings on both camera and phone are in sync.

AddThis Social Bookmark Button

Advertisements

3 comments

  1. I should mention that the method described above works with DNG files, ie Adobe’s standardised RAW format. GPicSync supports DNG. I always use Lightroom to convert my RAW files to DNG on import so the support for DNG is very helpful. I geotag my DNGs immediately after import from the card and then all subsequent edits, exports as jpeg etc retain the geotag.


  2. Regarding the GPSToday geologging format, if you select “Upload Log File” in the map GeoLogger menu, it will upload the selected file to the geoterrestrial website, from where you can download the file directly in GPX format.


    • Thanks for pointing that out. May well be of interest to anyone out there wanting to try this.

      Oh, and thanks for the application. It was just what I needed, and very nicely put together.



Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: