Thursday 20 August 2015

coordinate system - Should we always calculate length and area in lat,lng to get accurate sizes/lenghts of real world measurements


Heres is the simple case, that we discussed at the office today.


Given a map in local projection where units are meter. Since we are in denmark and we have some very local projections at our hand I will make an example using two projections here.


First one: http://epsg.io/32632 (UTM 32, a very large local projection)



Second one: http://epsg.io/4097 (DKTM1, a very local projection).


The first Point of interest in both coordinate system:



  1. http://epsg.io/map#srs=32632&x=511397.912332&y=6177295.039367&z=21&layer=gmaps-satellite

  2. http://epsg.io/map#srs=4097&x=211402.25&y=1179643.35&z=21&layer=gmaps-satellite


and the second point of interest in both systems:



  1. http://epsg.io/map#srs=32632&x=508321.748862&y=6177119.058277&z=21&layer=gmaps-satellite

  2. http://epsg.io/map#srs=4097&x=208324.91&y=1179467.30&z=21&layer=gmaps-satellite



Now that we have defined the two points in both system we read out the coordinates for both in both systems and calculate the length between them using Pythagoras.


Distance in DKTM1 (EPSG:4097) is  : 3082.372235
Distance in UTM32 (EPSG:32632) is : 3081.193264

So the next question is, what is the accurate actual distance in the real world if we send out a guy on the runway to measure the distance between these two points?


How would i calculate this using mathematics? Reproject to lat,lng and do something there?


I will buy a beer for the one that provides the best example, and you can pick it up at either of the two locations :)



Answer



For a small distance like 3081 or 3082 meters, it shouldn't matter very much for most applications which "projection" you use (as you've seen ~1m) but you don't want to use lat/long (geographic coordinates). For calculating large distances you should probably use an Equidistant Projection which will calculate distance minimizing distance distortion.



You typically will get a better result that minimizes distance distortion by using a local Cartesian system. You would rarely want to use a Geographic system since distance varies greatly at different points on the earth. I would make the assumption that the DKM1 projection is giving you a better result since you said it was "very local".


If you really want to calculate distances using latitude and longitude, you can use the Haversine formula which uses trigonometry to calculate a "great circle" distance (shortest distance between points on a sphere) or the even more accurate Vincenty Formula.


See Link on projection distortion
I'm also referencing: "Learning Geospatial Analysis with Python" by Joel Lawhead which has python code for calculating distances with the Pythagorean Theorum as well as Haversine, and Vincenty.


EDIT - To address your comment: My interpretation of this in the book that I referenced was that bringing in the geographic coordinate system even with the more precise Vincenty formula adds some error to the calculation. The author uses the Mississippi Transverse Mercator Coordinate system (MSTS) to calculate the Euclidean distance initially and treats that as the correct distance (+/-). We all know it is not "correct" since the datum and ellipsoid used provide a model only and this model is not ever going to be perfect. I believe it is treated in the book as the most accurate known way to calculate the distance without using surveying instruments on the ground. If no "more local" coordinate system is known, UTM would still give the best answer.


In that example the distances are measured in Kilometers and the error is about 0.1 Km even with the Vincenty formula (240.2 from MSTS vs. 251Km using Decimal Degrees converted to Radians vs. 240.6Km-Haversine vs. 240.1Km-Vincenty).


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