Exploring Oxpoints: directions from place to place

In order to demonstrate the data now available in Erewhon’s
geodata store, Oxpoints, I wanted a way to quickly browse
the holdings on a simple web page. Oxpoints already has a way
to show a map of all departments (for example), by opening
http://m.ox.ac.uk/oxpoints/departments.kml, but that means opening
Google Earth or loading it into Google Maps. If instead we
specify
http://m.ox.ac.uk/oxpoints/departments.xml, an XML
representation of all the data is returned, which can be fairly easily
transformed into HTML for display.

Since we have a lot of XSLT expertise to hand in the Erewhon project,
I decided to write this service as an XSL transform, mediated by a
Perl CGI wrapper. The result is shown at
http://m.ox.ac.uk/cgi-bin/oxshow.pl:
oxshow1

Selecting one of the type categories on the left provides a list of
places:
oxshow2
Selecting one of the entries gives a more detailed page,:
oxshow3
Notice here the link “Directions from railway station”. This turned
out to be surprisingly easy to implement, as Google Maps has query
parameters to do almost anything at all (as detailed at
http://mapki.com/index.php?title=Google_Map_Parameters).
Following that link gives us a Google map with the appropriate directions all in
place:
oxshow4

How did that work? What the XML returned us was the following (simplified a bit):

  <College rdf:about="http://m.ox.ac.uk/oxpoints/id/23233234">
    <primaryPlace rdf:resource="http://m.ox.ac.uk/oxpoints/id/23233235"/>
    <occupies>
      <rdf:Bag>
        <rdf:li rdf:resource="http://m.ox.ac.uk/oxpoints/id/23233238"/>
        <rdf:li rdf:resource="http://m.ox.ac.uk/oxpoints/id/23233237"/>
        <rdf:li rdf:resource="http://m.ox.ac.uk/oxpoints/id/23233236"/>
        <rdf:li rdf:resource="http://m.ox.ac.uk/oxpoints/id/23233235"/>
      </rdf:Bag>
    </occupies>
    <hasHomepage rdf:resource="http://www.exeter.ox.ac.uk/"/>
    <dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Exeter College</dc:title>
  </College>

This tells us that

  1. we have a College, with an id of 23233234
  2. it has a main place of residence, a building identified as
    23233235
  3. it occupies 4 other buildings
  4. it has a name
  5. it has a web page

That gives the information for the list, and the information display;
to get the map coordinates we have to visit each one of the buildings
in turn (by following a URL such as http://m.ox.ac.uk/oxpoints/id/23233238),
which gives us data like this:

 <Building rdf:about="http://m.ox.ac.uk/oxpoints/id/23233238">
   <hasLocation>
     <j.0:Point>
       <j.0:pos rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
       >-1.2557458877563 51.75420686635154</j.0:pos>
      </j.0:Point>
   </hasLocation>
   <dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Saskatchewan Room</dc:title>
 </Building>

which provides the critical pair of coordinates (-1.2557458877563
51.75420686635154) which locate the place. With that in hand we can ask
Google Maps to display a marker at the right place by going to
http://maps.google.co.uk/?q=-1.2557458877563,51.75420686635154

Now we have to find the coordinates of the railway station, and
use the saddr and daddr parameters to Google
maps:

http://maps.google.co.uk/?saddr=Station@51.753468,-1.269795
  &daddr=Exeter@1.2557458877563,51.75420686635154
  &dirflg=w=

Notice also how we can name a location by prefixing the coordinate with a word
and an @ sign. The “dirflg” parameter sets the route finding mechanism
to use its walking, rather than driving, mode. Anyone who has visited
Oxford will know why this is a sensible method!

A simple application, with not much work required on our part, now
that the Oxpoints data is available in a consistent and reliable form;
building, of course, on the very powerful facilities provided by Google.

One Response to Exploring Oxpoints: directions from place to place

  1. Excellent site, keep up the good work

Leave a Reply

Fill in your details below or click an icon to log in:

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: