GIS Tips – Getting OSTN02 to work with QGIS 2.2

If you follow me on Twitter, you will know how frustrated I have been lately with QGIS and getting the Ordnance Survey transformation to work fully. With QGIS 2.2 came a lot of great changes, the best for me was the ability to add custom transformations, this gave me the ability to apply 7 parameter transformations to my data which would get within 4m accuracy (2m on average).

Recently Sourcepole released a blog which highlighted how grid transformations could be added directly to the core SRS database in QGIS. I’ve adapted what is shown on here to work with the OSTN02 NTv2 file.

First a small disclaimer – This is the method which I used on a Windows 8.1 machine running QGIS 2.2 on an OSGEO4W 64bit install, if you are a developer and have a better method, pleeeeeaaaasssse provide it, otherwise I provide this as an easy fix until this is made part of the next QGIS release.



1. Unzip the OSTN02 zipfile and save the OSTN02_NTv2.gsb file to the ./share/proj folder of your QGIS install (for the OSGEO4W, this is C:/OSGEO4W/Share/Proj/ )


2. Open the SQLite browser you installed and click “File” and then “Open Database”. Navigate to .\apps\qgis\resources\ and open the srs.db file.


3. Once open, select the “browse data” tab and select the tbl_datum_transformation table.


4. Scroll to the bottom of the table, the cells can be changed by double clicking on each cell in turn and changing the value, then selecting the bottom right “save changes” option. Once all changes have been made, save the table using the save option at the top left of the GUI.


For my version, I just changed the values in the last record (line 775). The values I used were as follows;

epsg nr: 27700

coord op code: 100012

source crs code: 4277

target crs code: 4326

coord op method: 9615

p1: OSTN02_NTv2.gsb







Remarks: Put what you want in here, I put the Ordnance Survey disclaimer text to ensure copyright was adhered to.

Scope: As above, put what you want

Preferred: 1

depreciated: 0

area of use code: 1264


5. Goto line 210 (should be the Helmert toWGS84 transform) and change the preferred cell to 0 and the depreciated cell to 1.

6. Save table and close.

7. Open QGIS and go to “settings” and then options. Remove any default datum transformations and then ensure the “ask for datum transformation” option is selected.


Add a WGS84 data and then an OSG36 data into the same frame, when the OSGB36 is added you should get a pop up with the option to use the OSTN02!!


So far I have found this to be reliable and and levels of shift are almost invisible, inline with the 0.001m claimed by Ordnance Survey.

Now that you have changed the srs.db you won’t be too interested in downloading the one here to replace yours to save you time.

If you need 2 files to test, there are 2 shapefiles (1 in WGS84 & 1 in OSG36) available here, they are both the same data but in different coordinate systems and should perfectly align, if they don’t, then there is a projection shift problem!

Nick D

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.