Using grid references
a guide for web developers to converting OS grid references to latitude and longitude.

If you have arrived here in search of an online grid reference to latitude/longitude converter, you are probably out of luck. While you will find here a command line utility for Unix-like systems, there is nothing here for the average user - no matter - go back to your favourite search engine and you will find plenty.

If however you are a web developer seeking ways to use Ordnance Survey (Great Britain) grid references in your sites, you are in the right place. You will find:

  • Links to a perl library and command line utility to output latitude/longitude from a 6 figure grid reference.
  • PHP functions to call the above perl script
  • ModX snippets to display Google Maps (which require latitude and longitude as inputs). No doubt users of other CMS's will be able to adapt these as required.

I will be assuming you have Perl and PHP both installed on your machine. These pages are intended for web developers, and hence I am assuming you are using an up to date standards compliant browser...

Nutclough Images

This information is ©2008, Tim Spencer.

See more of my work here.