Saturday 20 June 2015

coordinate system - Measuring world-wide distances in QGIS


My guess is that I'm doing something wrong with QGIS, but here goes.


I have multiple point data layers in WGS84, mostly of UK locations, but with point in Canada, South Africa and New Zealand. I also have line data generated from the point data with MMQGIS/Hub Lines. What I need are accurate distances (line lengths) for the Hub Lines. I have tried this in QGIS 2.12.2 in Windows 32-bit, and in 2.16.1 in Kubuntu 64-bit. The processor is an AMD A-series quad-core, and 8GB RAM.



First, I have remembered to change to an equidistant projection to correct the distortion in WGS84, and have tried using On the Fly re-projection, and simply starting a new project with minimal point and line data all converted to, for example, World Azimuthal Equidistant, but I am getting severe errors. To simplify my explanation I have also tried the QGIS tutorial on calculating line lengths here: http://www.qgistutorials.com/en/docs/calculating_line_lengths.html


Following these tutorial instructions gives me a result for uident: 1506 (first line of attribute table) of 0.01 km; most other entries are 0.00 km. The correct result appears to be 637.07 km. If I calculate another column from this data in meters, without the division by 1000, the same entry shows the line to be 8.40 m in length. Further, if I load a Natural Earth country boundaries map to this project and re-project, the line measurement tool shows the whole of mainland USA (excluding Alaska) to be roughly 50 km east-west, and 25 km north-south. I am getting similarly wild results in my own data.


What have I got wrong?


EDIT: Turning Linux off and turning it back on again has cured the issue in the tutorial mentioned above; but why? And why do I still have the error in my own data? In the latter the distance from Bristol, UK to Auckland, New Zealand is calculated at 0.154 km, and the measuring tool shows the same.


I am still getting something wrong. If I now add the Natural Earth world coastline layer to the project with On the Fly project active, all my point and line data shrinks into a spot at coordinate 0,0.



Answer



If you want to get correct distances on a worldwide scale, you need an azimuthal equidistant projection centered on the start or destination point. See great circles in QGIS and export in 3857 webmap for an example.


A line drawn in WGS84 is not the shortest path, you need the Great circle line between your points. And you have to reproject the data into a projected CRS. Otherwise you get distances in degrees, not meters.


Most probably you have used Set Layer CRS instead of reprojecting the data with Save As ... to a new filename and different CRS.


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...