Wednesday 27 December 2017

postgis - QGIS and MapInfo Projections - EPSG 27700 (British National Grid)


I have some data in a PostGIS table with the projection EPSG 27700. If I export this data from QGIS (v1.8) to MapInfo TAB / MIF when I open the data in MapInfo it has a shift on it.


Does anyone know why this happens? I don't get any problems if I open MapInfo data directly into QGIS, but I did notice that QGIS opens the data with a custom projection.



Answer



I'm unable to comment at the moment, so my only option is to reply here, although this isn't an answer.


Can you describe what the magnitude of the shift is and how you are observing it - comparing the reported coordinates of vertices in QGIS and MapInfo, or comparing the alignment with a different dataset? If the latter, then is the other dataset also British National Grid, or might there be a coordinate system transform being done on the fly by both MapInfo and QGIS, as this would probably generate different shifts in the data.


Further exploration: If you view the coordinates for one feature directly from PostGIS by converting the geometry to WKT, how do the numbers compare to those observed in the MIF file - is the shift observed between these stages?


Following on from your comments, this is now an answer!


The shift that you describe corresponds exactly to what would be seen if the MIF file defined British National Grid using the WGS84 datum rather than the (correct) OSGB36 datum. On import, MapInfo will reproject the coordinates to their BNG position, which generates the shift.


You should be able to confirm this by examining the Coordsys line of the MIF file, which will begin CoordSys Earth Projection 8, 104 (BNG using WGS84). If you alter this portion of the line to CoordSys Earth Projection 8, 79 (BNG using OSGB36) the coordinates should appear in the correct location.



I can recreate this behaviour in QGIS 1.7 (which uses GDAL 1.8) - this is a bug, but most probably in GDAL rather than QGIS itself (more investigation required!). A workaround is to export to ESRI Shape (or GML) and then open that in MapInfo, specifying British National Grid as the Coordinate System.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...