Generating your holiday photos automatically with the iPhone location database

As you may have read, the iPhone 4 stores a database of your location over time, and it’s simple to access this database on your computer. Notwithstanding the privacy implications, it provides an interesting source of data to play with!

I’ve spent the last few months travelling while working for ReignDesign, and my iPhone has been faithfully recording the trip. I extracted the consolidated.db file which the iPhone stores in its backup, and wrote a small Python script to extract my location history. The script finds the first recorded location for each day, and then:
1. Looks up the city name and country using Google’s Geocoding API
2. Searches for photos with the Flickr API taken close to the latitude/longitude I was at, on that day

Note that not every day has a location recorded. When I was in Tonga and Samoa, I didn’t have a SIM card. Since the consolidated.db file uses cell towers to calculate location, not GPS, there are gaps. Also, sometimes there are no photos on Flickr for a (location, date) pair.

With those caveats, put it together and you have what I call “the lazy man’s holiday photos”:

View my holiday photos >>

Matt Mayer

Matt Mayer is a founder at ReignDesign. Matt is from the UK and was based in Shanghai for ten years. He is now living in Bangkok, Thailand.

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Share this post