Blog
Books
Talks
Follow
Me
Search

Larsblog

The year 2005 in travelling

<< 2006-01-05 21:55 >>

Norm Walsh had the excellent idea of publishing a map showing his travels (via Column Two), and I couldn't resist the temptation to do the same. Of course, I used what I've learned about the Google Maps API to create an interactive map instead.

Anyway, below is the map, draggable and zoomable, and you can also click on a place to see when I was there, and for what event.

Show routes

Colophon

So how did I create this? Well, I had to do it automatically, of course, or there would be no fun. I realized that my photo topic map contained the information I needed (mostly; I've probably missed one or two trips), except for the coordinates of the places I've taken pictures. I added support for this to the photo topic map editor (in 10 minutes on the bus back from work), and then added the coordinates for the places I visited in 2005 (in about 2 hours).

After that, finding all the places I visited in 2005, with coordinates was easily done with this tolog query:

using occ for i"http://psi.ontopia.net/xtm/occurrence-type/"
using photo for i"http://psi.ontopia.net/tmphoto/#"
using geo for i"http://psi.ontopia.net/geography/#"
import "http://psi.ontopia.net/tolog/string/" as str

contained-in($P1, $P2) :- {
  photo:contained-in($P1 : photo:container, $MID : photo:containee),
  contained-in($MID, $P2) |
  photo:contained-in($P1 : photo:container, $P2 : photo:containee)
}.

select $PLACE, $NAME, $LAT, $LONG from
  occ:last-modified-at($PHOTO, $LASTMOD),
  str:substring("2005", $LASTMOD, 0, 4),
  photo:taken-at($PHOTO : photo:photo, $TAKEN : photo:location),
  /* next line accounts for photos taken in a place contained in a city */
  { contained-in($PLACE, $TAKEN) | $PLACE = $TAKEN },
  geo:latitude($PLACE, $LAT),
  geo:longitude($PLACE, $LONG)?

I then just generated a little HTML snippet for each result row from the query.

Doing the lines was a little more complicated, but done with a Jython script. The script basically walks all the photos from 2005 (found with a similar, but simpler, query) and notes when the location shifts. It then assumes that if the event for both is the same (say, bicycle holiday in Germany) then I've gone from the first to the second, and that if the event is different I've gone via Oslo. This works out fine in practice, except where one trip has two events (the bicycle holiday is divided into wedding and holiday but really was one trip). It can also be a little approximate at times. The script thinks I went from Oslo to Saint Brigitte-des-Saults (a tiny place outside Montreal) because the first picture on the trip is from there. I touched up the German problem manually, but left the rest as it is.

Lessons learned

Most of the time was spent actually getting the coordinate data for the different places I'd visited. This means that producing a similar map for 2004 is about as much work as this one was. The lesson is that if you have the data you can do anything, and if you don't have the data it winds up being a lot of work.

Interestingly, the Mondial topic map has coordinates for some of the cities I've visited, but no PSIs for them. If Mondial had been more complete, and both topic maps had had the same PSIs this would have been a piece of cake. (Actually, name matching would probably have worked well enough here.)

Similar posts

The web's identity crisis and httpRange-14

URIs are used to refer to both information resources (which are downloadable over the net) and abstract concepts and physical objects (which are not)

Read | 2007-10-08 08:54

RBNAG '07

The title probably makes it sound as though I've been to yet another IT conference, but this was actually something completely different

Read | 2007-11-06 23:58

Travels in 2006

Last year I did a Google Map of my travels in 2005, and so of course I wanted to do it again this year

Read | 2007-01-06 14:27

Comments

Norman Walsh - 2006-01-06 14:03:15

Sweet! I might have to steal that idea. Maybe for 2005. Almost certainly for 2006!

Laender - 2006-05-03 00:27:08

Thats a really cool idea! Im not very good in using this api, but when I see this, maybe... :)

Add a comment

Name required
Email optional, not published
URL optional, published
Comment
Spam don't check this if you want to be posted
Not spam do check this if you want to be posted