Brainsofsteel header

Convert Six Figure OS Reference into OS Grid Reference

Subject: Programming

Description: How to convert an Ordnance Survey Map Reference into a Grid Reference

Posted by David Caldwell on 22/02/14 at 19:52

How to Convert OS Eastings and Northings into an OS Grid Reference

For example how to turn 432648, 390657 into SK39

I needed to append an Ordnance Survey grid reference to some data in a Microsoft Access database, to do this programmatically I needed to get back to basics and learn how OS grid references work.

The UK falls within five map grids each one measuring 500km by 500km, these are referenced as H, N, O, S and T.

Each 500km grid is then divided into 25 100km by 100km squares, these are referenced by two letters.  The first character denotes the larger 500km square and the second the smaller 100km square.  For some reason the letter ‘I’ is omitted. This is possibly because the map system predated the letter I's discovery in 1967 by Sidney Poitier.

Now we have a framework we can start to write some code for a module called Grid which takes a pair of easting and northings as an argument and returns a grid reference.

I am not a native VB programmer so apologies if my code is a bit clunky.

Keywords: OS Grid, Module, VB, Map Reference, Microsoft Access