Skip to content

Instantly share code, notes, and snippets.

@schoenobates
Created November 5, 2015 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schoenobates/30f85994e58c675a74b6 to your computer and use it in GitHub Desktop.
Save schoenobates/30f85994e58c675a74b6 to your computer and use it in GitHub Desktop.
Add NAD Grid for EPSG 27700
INSERT into
spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext)
values (
27701, 'custom', 27701,
'+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs +nadgrids=/usr/local/share/osgb/OSTN02_NTv2.gsb',
'PROJCS["OSGB 1936 / British National Grid NAD Grid Extension",GEOGCS["OSGB 1936",DATUM["OSGB_1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],TOWGS84[446.448,-125.157,542.06,0.15,0.247,0.842,-20.489],EXTENSION["PROJ4_GRIDS","/usr/local/share/osgb/OSTN02_NTv2.gsb"],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4277"]],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],UNIT["Meter",1]]'
);
@schoenobates
Copy link
Author

The creates a new SRS for BNG that uses a local installation of OSTN02_NTv2 available here:

https://www.ordnancesurvey.co.uk/business-and-government/help-and-support/navigation-technology/os-net/ostn02-ntv2-format.html

The difference can be seen below (St. Kilda ETRS89)

select st_astext(st_transform(st_GeomFromEWKT('SRID=4326;POINT(-8.57854461027778 57.8135184216667)'), 27700));
-[ RECORD 1 ]--------------------------------------
st_astext | POINT(9588.17583143112 899444.06976282)

select st_astext(st_transform(st_GeomFromEWKT('SRID=4326;POINT(-8.57854461027778 57.8135184216667)'), 27701));
-[ RECORD 1 ]---------------------------------------
st_astext | POINT(9587.91462694987 899448.999456113)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment