Last June a number of Multimap developers had a fantastic time at the BBC Yahoo! HackDay event, our own Andy Hume and ex-Multimapper Richard Rutter even won the award for “Most useful” hack.
This year we’re really excited to be one of the sponsors of the 2008 event, Mashed. We’ve taken the opportunity to refresh our free Open API offering in time for the event with some really cool additions. These include access to our REST APIs for geocoding, directions and POI search (including geo-tagged Wikipedia articles), high-resolution aerial and Bird’s Eye imagery from our friends at Microsoft Virtual Earth and lots more.
In the spirit of the event we’ve also been burning the midnight oil and, fingers crossed, will have a few last-minute goodies which we’ll link to from http://multimap.com/mashed08.
One such late addition is a transformation API for British National Grid Reference co-ordinates. We’ve noticed some of our Open API developers have geodata with grid references or eastings and northings which they’d like to convert to latitudes and longitudes to use with our JavaScript API. Although there are client-side conversion algorithms available we are able to provide a higher accuracy conversion server-side, taking into account the National Grid Transformation OSTN97 linear shifts.
Converting from British National Grid via the REST API
Our REST API supports single or multiple eastings (x) and northings (y) pairs or grid references and JSON, XML and KML output formats. The following examples convert two co-ordinate pairs and a grid reference:
Converting from British National Grid via the JavaScript API
The JavaScript Open API provides a convenient wrapper to the REST API for client-side use. The MMConverter object will take an array of MMPoint objects, and via a callback mechanism returns an array of MMLocation objects, for example:
var locations = new Array();
locations.push(new MMPoint(523000,212324)); // OSTN97 OS National Grid co-ords
locations.push(new MMPoint(323000,212324));
locations.push(new MMPoint(423000,212324));
var funcRef = convertResultsLoaded;
var converter = new MMConverter( funcRef );
converter.convert(locations, ‘gb’);
function convertResultsLoaded() {
console.log(converter.result_set);
}
Please feel free to come and find me or my colleagues at Mashed (look out for people wearing the fetching black Multimap t-shirts) if you have any questions about the Multimap or Virtual Earth APIs or location data and services in general.
Happy hacking!
