Tales of deering do: story enrichment with XQuery, eXist and Google Maps

The Bristol Sailing Association (BSA) has played an important part in my life.  It is where I met my wife, where we learned to sail and a support for us during our circumnavigation. A bunch of good friends and intrepid sailors. BSA was established 20 years ago as a group of keen but boat-less sailors to organise yacht charters in the UK and occasionally abroad.  Membership has been steady at around a hundred.  We meet each month in a converted barge to plan future trips, to recount stories of past trips and naturally to down the odd bevy.

BSA has a website but I'd not taken much interest it until the secretary asked at the last meeting for a volunteer to do a makeover.

The site was certainly in need of some love. Apart from contact names and addresses for the officials, the association rules and a couple of other documents, the main contents are past newsletters as Word documents.  My first inclination was to suggest moving to Wordpress so that the secretary and skippers could post news items more easily. But I got to thinking about the newsletters and what more might be done with them.

The newsletters are written by the secretary after each monthly meeting and contain information on arrangements for forth-coming trips and the reports of recent trips.  These reports are written and presented by a member of the crew at the previous meeting, are often amusing and always interesting, describing passages made, weather conditions, meals enjoyed, alarums and excursions.  Buried away in Word documents, these are hard to access yet are the most valuable asset, indeed the only asset apart from the members which the club possesses.  Over the 20 years there must have been several hundred reports, many I suspect now lost, although I could recover most for the past 8 years.

So the idea formed of creating a web site which made better use of these stories.  The plan is to convert each to XML, annotate each story with links to common entities, such as members, vessels and locations (marinas, pubs, buoys) and provide a linked, searchable site.

Here is  the prototype site covering half a dozen trips. It uses the Google Maps API version 3, looks nice in Firefox but still somewhat messy in Opera and IE7 -probably doesnt work at all in IE6 and older, but there is kml mapped with Google Maps as backup.

Although some of the data is structured, such as details of members, boats, locations and oranisations, the bulk of the data is in the form of the stories, the trip reports.  The application architecture uses a model-driven approach to the structured data whilst stories are structured XML documents with inline markup for annotations. The model-driven editor will look after the structured data and I need to work on a web-based editor for the annotations.

The main annotation element marks space-time locations during the trip, defining a location by lat/long,  date and time. A generic <ldt> element with attributes of location (a ref to a named location - we are creatures of habit), lat, long (if no location), date (or a day offset) and time.  Undefined attributes default to the preceding value of the attribute.

The added space-time coordinates allow the story  to link to contemporaneous data to provide additional context.  Knowing the position and date, we can retrieve historical METAR reports from the nearest airport. Knowing the date, we can retrieve the news events from Wikipedia. The augmented trip data is cached in the database for ease of generation of a text summary and map infowindows

There is a privacy issue in this work.  Although all the raw data is present in the monthly Word documents, exposing the trip reports and the roles of people in those stories alters the accessibility to the data.  I need to consult with the members to see how they feel about this.

The key idea here is to enrich the stories with contemporaneous information. It's not always easy to obtain the historical data to do this. I struck it lucky with the archive of METAR reports from  I'd love to include the shipping forecasts and have contacted the MET Office to see if these are archived and accessible. But the real test will be to see if the current and future members of the asssociation find this useful.







Great idea, love it. Each trip map seems to zoom in on the start point which is maybe as you want it, but if you wanted it to zoom out and centre upon the middle of the trip you just need to add "bounds".

var bounds = new google.maps.LatLngBounds();
bounds.extend( point1 ) ;
bounds.extend( point2 );
// and so on

Then you can call

map.fitBounds( bounds );

Thanks Paul - that's very helpful - I've just spent some time computing the center of the route and a suitable zoom level based on the computed extent! Now why didn't I read the documentation first!
My pleasure, just re-reading your post - reminds me that this popped up on Twitter about an hour ago, might be of interest to you ..