Previously I wrote about the need to use the OSTN02 transformation when working between British National Grid (OSGB36 – EPSG27700) and WGS84 (EPSG4326) but I am astounded at the number of questions over why & how. It should never be the case that a developer contacts you to ask why a transformation is needed, let alone require explicit examples. Here we are though, I have spent the last 4 months fighting for the OSTN02 (or even the Helmert) transformation to be available in 3 GIS software to no avail, only questions…..so this post is to remind everyone that GIS isn’t about pressing buttons and hoping the code works but understanding HOW the core geodetics work so that the GIS output is precise.

## UK has more than 2 balls

Although to many of you, the British National Grid is the primary coordinate system, there is actually 3 national coordinate systems. One system is American but used in almost everything we do, the second is the European standard and the third is the British standard, why? Here I am going to try and explain simply enough for those who didn’t study at school…….

When I was a child I though the world was spherical, well, it’s not, in reality it is a biaxial ellipsoid similar to the one below.

Our earth rotates around the shorter axis (90° to the image above) and is not as perfect as the image above would suggest. If the ellipsoid was entirely perfect, creating a coordinate system would be an easy task, there would probably be 5 or 6 different systems for the whole world and they would be infinitely accurate.

Unfortunately this is not the case, there are bulges and gravitational fluxes which mean that there cannot be an accurate projected coordinate system for the world. We can have a fairly accurate global MODEL (datum), WGS84 is accurate to about 4cm anywhere in the world but this is only if you know how long a measure of Latitude/Longitude is where you are, this can be a bit of a pain if you have a complex polygon or are trying to plot the coast of a country……

So, the way we deal with this is to create “Local Ellpsoids” which provide a best fit for the areas. An example of this is the Airy ellipsoid (the ellipsoid upon which the OSGB36 datum is based) which is specific to the UK. The image below from Ordnance Survey shows how the ellipsoids can be used:

You can see how, on the left of the image above, the regionlly best fitting ellipsoid doesn’t perfectly match the earth but it creates a large region of best fit which allows for precise calculation.

## Balls to Ellipsoids

Ellipsoids are smooth, and the earth, as we discussed is far from smooth. Therefore I am going to bring in the concept of height…..afterall, if we are going to talk about ellipsoids and bulges then we also need to understand how the ellipsoids are modelled to be as precise as they are, but how high is high? Have you ever wondered why your GPS is wrong? Where does it measure the height from? Actually how high is high?…..

If we want to measure height we need a zero level, a point we can all ground, this is a model known as a Datum. At this point I could start getting technical and discuss how gravity affects height and ramble on for another 3 paragraphs or so but that would probably confuse most of the target audience here, lets just reference that I told you so that I can’t be blamed for not mentioning it 😛

## Ellipsoids? Datum? It’s ALL Balls!

Okay, there we have it, the quickest and most basic lesson in geoids ever….if this is going to be used for anything more than reference, I strongly recommend you read more on the subject,Ordnance Survey do a great guide which makes it easy for the complete noob to read & IT’S FREE: Ordnance Survey guide to coordinate systems

Before I go on to answer the question posed in this blog, I am quickly going to clarify the coordinate systems discussed so far:

World Coordinate System: WGS84 (EPSG4326)

GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, PRIMEM["Greenwich",0, UNIT["degree",0.01745329251994328,

European Coordinate System: ETRS89 (EPSG 4258)

GEOGCS["ETRS89", DATUM["European_Terrestrial_Reference_System_1989", SPHEROID["GRS 1980",6378137,298.257222101, AUTHORITY["EPSG","6258"]], PRIMEM["Greenwich",0, UNIT["degree",0.01745329251994328,

United Kingdom Coordinate System: OSGB36 (EPSG 27700)

PROJCS["OSGB 1936 / British National Grid", GEOGCS["OSGB 1936", DATUM["OSGB_1936", SPHEROID["Airy 1830",6377563.396,299.3249646, PRIMEM["Greenwich",0, UNIT["degree",0.01745329251994328, UNIT["metre",1, PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",49], PARAMETER["central_meridian",-2], PARAMETER["scale_factor",0.9996012717], PARAMETER["false_easting",400000], PARAMETER["false_northing",-100000], AXIS["Easting",EAST], AXIS["Northing",NORTH]]

All of a sudden some of that text makes a little sense, doesn’t it!!

## Ok, I get the point, 3 coordinate systems….at some point I’ll need to make sure there isn’t any error

So, finally, back to the original question and I hope by now it has become fairly evident why we need transformations in our lives. Most onshore and offshore survey in the UK is done in ETRS89, this ensures the best level of accuracy (and because GPS systems are ETRS89/WGS84 based) when recording coordinates. Unfortunately this does not marry well with British National Grid because they are 2 different datum (it only took me 5 paragraphs to make that point) – to remove any potential distortion and minimise error, we require a transformation.

In the UK without a transformation we would get errors from 50m to 150m, with a simple 7 parameter transformation we can obtain accuracy to about 5-7m. The 7 parameter transformation is commonly known as a Helmert transformation and, as the name suggests, provides 7 shifts to the coordinates to create a “best fit”.

For those interested, tx, ty & tz are translations along the x,y,z planes and rx,ry & rz are rotations. This snippet was provided by Ordnance Survey.

To ensure the level of accuracy required for building housing or mapping real world issues, a more accurate system is required. The transformation system for the UK which transforms ETRS89 to OSGB36 is called OSTN02 (Ordnance Survey Transformation Network 02) – this is a GRID of transformations based on measurements and corrections placed all over the UK, thus it erradicates almost all distortion, with a level of accuracy to about 2cm anywhere in the UK (within about 1km offshore).

Some people might try to confuse you with the term “NTV2” this refers to “National Transformation Version 2” which is more to do with the format of the file itself (.gsb). The transformation can be downloaded here: OSTN02

## I’ve got it but what do I do with it?

And here lies the million pound question – the .gsb format was designed to make it easier for software to adopt the grid transformation but only a handful of software currently supports it.

Obviously, professional software like Fledermaus, AutoCAD, ArcGIS & MapInfo support the NTV2 format but some more popular software which you would expect to support it, don’t, these include, GRASS & QGIS 2 (1.8 & 1.9 d0 support NTV2).

Now that you know the above information, you’ve got to ask yourself, how can anyone work on UK GIS data without OSTN02?!

Please feel free to carry on the discussion with me on twitter I am @dragons8mycat

Nick D

Never used QGIS yet, But if you want the prj file to include the gsb file try (adjust or omit the gsb path):

PROJCS[“OSGB 1936 / British National Grid”,

GEOGCS[“OSGB 1936”,

DATUM[“OSGB_1936”,

SPHEROID[“Airy 1830”,6377563.396,299.3249646,

PRIMEM[“Greenwich”,0,

UNIT[“degree”,0.01745329251994328,

UNIT[“metre”,1,

PROJECTION[“Transverse_Mercator”],

PARAMETER[“latitude_of_origin”,49],

PARAMETER[“central_meridian”,-2],

PARAMETER[“scale_factor”,0.9996012717],

PARAMETER[“false_easting”,400000],

PARAMETER[“false_northing”,-100000],

AXIS[“Easting”,EAST],

AXIS[“Northing”,NORTH],

EXTENSION[“PROJ4″,”+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000 +y_0=-100000 +ellps=airy +nadgrids=c:\OSTN02_NTv2.gsb +units=m +no_defs”]]

You can also do a similar prj with TOWGS84 parameters instead of EXTENSION…use:

TOWGS84[446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894]

Hi Steve,

Thanks for that, QGIS 2.0 uses PROJ4 and recently added support for custom CRS. Unfortunately the methods outline above are well documented and for some reason do not work. I had some small success with this method in GRASS but there was still a projection shift of around 10m.

I would highly recommend this method for anyone developing their own web applications.

Hi Nick,

I tried QGIS 32 bit, and with trial and error managed to get the NTV2 file to work (no noticable shift).

Using the above prj content did not work, but the following did:

PROJCS[“OSGB 1936 / British National Grid”,GEOGCS[“OSGB36”,DATUM[“OSGB36”,SPHEROID[“Airy_1830”,6377563.396,299.3249646]],PRIMEM[“Greenwich”,0.0],UNIT[“Degree”,0.0174532925199433]],PROJECTION[“Transverse_Mercator”],PARAMETER[“False_Easting”,400000.0],PARAMETER[“False_Northing”,-100000.0],PARAMETER[“Central_Meridian”,-2.0],PARAMETER[“Scale_Factor”,0.9996012717],PARAMETER[“Latitude_Of_Origin”,49.0],UNIT[“Meter”,1.0],EXTENSION[“PROJ4″,”+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +nadgrids=OSTN02_NTv2.gsb +units=m +no_defs +wktext”]]

Cool!! Could have saved you some time, the OSGEO4W installer works….tried it last night after many emails saying “what problem?”

Your solution works and seems a better option for my OCD, thanks

Do you have any idea about how many meters (in real world) would be constituted for a decimal point in British National Grid CRS. Atleast approximately ?

British National Grid [epsg 27700] is measured in metres. Using grid transformation OSTN02 it can be transformed with centimetre accuracy (2m with a Helmert transform).

Therefore 0.1 would be 10 centimetres

0.01 would be 1 centimetre

Nick D

Nick, I think she is asking how many metres in 0.1 decimal degrees lat&long. Not sure if wgs84 lat&long or osgb36 lat&long? I’d answer myself if I was at a computer.