Marking an OS Grid Reference position on a Google Map

Last week I blogged over at PC Pro on how to display a location marker on a Google Map. This assumes that you either enter a standard address and/or postcode/zipcode and relies on Google’s Geocoder to perform the transformation from the entered details into a latitude and longitude value.

All good. But I received one comment on my PC Pro article asking about OS (Ordnance Survey) Grid References and displaying them on a Google Map.

Now I know nothing about converting OS Grid References, but I performed a quick search and came across a complete set of JavaScript functions covering just that.

Written by Chris Veness over at Movable Type Ltd., this list of (complicated!) JavaScript functions provides methods to convert between latitude/longitude & OS National Grid Reference points.

Taking this set of functions, I adapted the code used in the PC Pro examples and created a page that takes an OS Grid Reference and displays it on a Google Map.