Adding Open Domesday data to object records

The Scheme website has had low level integration with the Open Domesday project site since September 2011, and it has taken me this long to get round to writing about how it works. Each record we create, ideally should have a National Grid Reference (NGR) attached to it. These NGRs are converted at the point of data entry, via a backend script, to Latitude and Longitude which gives us more flexibility for integrating with 3rd party services (mapping apis, flickr, etc.) These LatLon pairs can also be used to retrieve data easily from Open Domesday, via Anna Powell-Smith’s excellent API.  In this instance, I’m interested in just places near to the point of discovery of an object, and this can be seen in the segment of a record displayed below.

Open Domesday data added to a record

Open Domesday data added to a record

The API call that you need to do this is ‘PlacesNear: returns places within a radius (in km) of a given point, or places within a bounding box. Uses WGS84 coordinates.’ This is very simple to call as her examples show you and I just use the following format:

To automate this in my Zend Framework based application, I’ve built some simple PHP library code and some view helpers as detailed below.

The service library classes

These can be seen here: https://github.com/portableant/Beowulf—PAS/tree/master/library/Pas/Service/Domesday

 

 The view helper

This needs rewriting for OO PHP and chained methods and perhaps moving HTML to a view partial instead. As always there are lots of different ways to write the code to get to the end point.

To use this:

 

Leave a Reply