The data I work with requires me to project between WGS84 (4326) and OSGB (27700), the default projection in PostGIS is using the older less accurate version of the projection.

I am trying to add both the OSTN02 and OSTN15 projections and have successfully added the .gsb files into

C:\Program Files\PostgreSQL\9.6\share\contrib\postgis-2.4\proj

and used

INSERT INTO "spatial_ref_sys" ("srid","auth_name","auth_srid","srtext","proj4text") VALUES (27715,'EPSG',27700,'PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB 1936",DATUM["OSGB_1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4277"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],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],AUTHORITY["EPSG","27700"],AXIS["Easting",EAST],AXIS["Northing",NORTH]]','+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs +nadgrids=OSTN15_NTv2_OSGBtoETRS.gsb ');

to create the new entry in the spatial_ref_sys table with a custom 'srid' number.

All of this works fine and I can see the difference in projections in QGIS.

However what I would like to do is have these projections available as default on new PostGIS extended databases? I tried entering the projects into the spatial_ref_sys.sql file but this doesn't seem to make a difference? Is there a way to do this?

  • After additional research on coordinate systems, QGIS and PROJ, it seems that this topic is a little more tricky when it comes to projections like the one I listed in the question. The newer version of PROJ (5.0) may help with my problem, but it may require other software to update before it solves my issue.
    – Andy Dixon
    Apr 4, 2018 at 16:00

1 Answer 1


You could create a new extension


that extend the database with postgis and then add your custom projections.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.