I have a few sets of photos that I've geocoded and show on maps. For example, the McGuffin Game and biking to Santa Cruz. Here's where I explain how I do it.


The basic idea is simple. I have a GPS periodically record my position and the time, and I take pictures using a digital camera, which puts a timestamp in the image file metadata. Later, on my computer, I correlate the two using the timestamps and figure out where I was at the time I took the picture. Then I use the Google Maps API to present it in a nice way.

Collecting the Data

  1. You need a GPS and a digital camera (or you'll need to do a ton of stuff by hand).
  2. Look at the time on the GPS and set your camera's time to match, as closely as you can.
  3. With the GPS turned on and recording a tracklog, take a bunch of pictures.
  4. If you can't set your camera's clock precisely to the second, take a picture of your GPS showing the current time.

Preparing the Tracklog

I use gpsbabel to get the tracklog from the GPS and store it in GPX format. Then I either remove the least significant trackpoints until it's about 400 points, or I split it into multiple tracks. This is because long tracks can be slow to draw. Eventually the rendering software will improve and I'll stop doing this.

Here's the python code I wrote that does most of the work: tracklog.py

Geocoding the Photos

If you took a picture of your GPS, you can see how much your camera's clock differs from your GPS'. Then you can adjust all the photo timestamps so they match.

Then more python to generate smaller versions of the images and the xml file that describes each photo (coordinates, dimensions, caption).

Displaying Everything

I use the Google Maps API to do all the real work. This all happens in your web browser, so you can poke around in the HTML and Javascript to see how it works.