[Proj] Using QGIS/proj4 to map WGS84 LL to OSGB36 (UK) grid

Hugo Tyson Hugo.Tyson at cpslocates.com
Tue Nov 8 04:33:56 EST 2005

Change Request/FAQ candidate: Using OSGB36 UK grid

Apologies if this is posted in the wrong place -
the audience is intended to be users and developers
of both PROJ and QGIS.

Versions in use: proj-4.4.9; qgis-0.7.0

Using QGIS and cs2cs (proj4), we were unable to convert
from WGS84 Lat/Long to OSGB36 grid references matching
the Ordnance Survey's own website:
(You have to register/log-in to use the converter)

Best we got was results roughly matching web OSGB tools
that don't do datum conversion, just projection (meaning
from OSGB36 datum Lat/Long to UK grid).

So we worked out that to get cs2cs to do the conversion
completely correctly, we had to tell it about the Airy
or OSGB 1936 *datum* as well as the Airy ellipse that 
it already knows about.  To do this you need to add a line
to the datums data (sic) definition table in pj_datums.c
and re-build/re-install. The table starts:
C_NAMESPACE struct PJ_DATUMS pj_datums[] = {
/* id       definition                               ellipse  comments */
/* --       ----------                               -------  -------- */
"WGS84",    "towgs84=0,0,0",                         "WGS84", "",

and the extra line (anywhere in that table) needs to be:

"airy", "towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894", "airy", "Airy 1830",

The numbers for the 7-value Helmert transformation came from the 
OS web document http://www.gps.gov.uk/guidecontents.asp
which gives the values for converting *to* OSGB36 - proj requires
the inverse of that: "towgs84=...".  This definition isn't exactly
the inverse, it just has the signs flipped.  Given the nature of 
the transformation that's good enough.

To use this datum in cs2cs, the runes to cast are these:
  cs2cs +proj=latlong +to +proj=tmerc +lat_0=49 +lon_0=-2
        +k=0.999601 +x_0=400000 +y_0=-100000 +ellps=airy
        +datum=airy +units=m +no_defs
which gives results within a couple of metres of the Ordnance
Survey's converter.  "+datum=airy" is the new bit.

PROJ-REQUEST: proj people, please include this datum in future
proj releases.

[QGIS-specifics snipped - this msg also in QGIS forum]

Thanks are due to proj and qgis authors et al for providing these
excellent tools in the first place.  We are using them just for
demo purposes, we're not in the GIS business at all, so they've
provided a very easy and useful way to start working in the
GIS world.

Thanks again and best regards,

	- Hugo

Hugo Tyson
Cambridge Positioning Systems Ltd
62-64 Hills Road


This email and any attachments are confidential. They have been checked for viruses but it is your 
responsibility to conduct your own virus checks.

Cambridge Positioning Systems Limited, 62-64 Hills Road, Cambridge, CB2 1LA, is registered in England 
under company number 2808344.
-------------- next part --------------
--- pj_datums.c~        2005-11-04 15:28:31.000000000 +0000
+++ pj_datums.c 2005-11-04 15:53:30.000000000 +0000
@@ -87,4 +87,5 @@
 "ire65",  "towgs84=482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",  "mod_airy",  "Ireland 1965",
+"airy",   "towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",  "airy",  "Airy 1830",

More information about the Proj mailing list