Re: Calculating a Distance on the Surface of the Earth



Victor Fraenckel wrote:
Ted Edwards wrote:
I chose to use Sodano rather than Vicenty since Sodano's algorithms are not iterative and this is generally faster, more accurate and more versatile in APL.
I have implemented both Sodano's and Vincenty's methods in both Visual Basic and Delphi. I did some rough testing to see how much influence the iterative method of Vincenty made on the calculation speed. In no case that I looked at did I find more then 3 iterations was necessary to reach convergence. I question your comment that Sodano's method is more accurate than Vincenty's. Were you saying that is the case using APL.

Apl is an interpreted array language. APL2 for OS/2, the version I use, does all floating point calculations in double precision. By using a non-iterative approach, I completely avoid the problem of determining satisfactory iteration end points. While I can say the accuracy is pretty good, I can only test using other implementations and self consistency.

Is that provable. I did not find it to be the case in my, albeit, limited testing.

Here are three chunks extracted from my testing: The first is a description, the second the results from the inverse method, the third, the results from the direct method.
"
Implementation and Testing of
Sodano's Inverse and Direct Algorithms in APL2
by
E.M. (Ted) Edwards

The two functions are called Sodano and SodanoD for the inverse and direct
respectively. Syntax: Both functions take a Lat Lon (in decimal degrees)
referance point as left argument.

Sodano takes a single point (two element vector of Lat Lon) or a vector of
these as right argument and returns a two element vector of geodesic distance
and initial radial clockwise from North or a vector of these.

SodanoD takes a single vector (geodesic distance in meters and initial radial
in degrees clockwise from North) or a vector of these as right argument and
returns a two element vector of Lat Lon at destination or a vector of these.

Numeric results are expressed in meters and degrees clockwise from North for
distances, R, and radials, A. Comparisons are in millimeters and/or arcseconds.
Lat and Lon are positive for North and East.

Tests used 5 pairs of points given as lat/lon in WGS84. The pairs were in various directions and ranged in separation from 22m to 17000Km.

°°°

Testing of the inverse was done by comparing my results with those returned
by the Java calculator at Ed Williams' "Aviation Formulary",
http://williams.best.vwh.net/avform.htm
The test results:
R(m) A(deg) dR(mm) dA(sec) dR÷R dA÷A
22.034 334.6 -0.0082 0.16 -3.7E-7 1.4E-7
2068.298 179.9 -5.1E-6 0.00092 -2.5E-12 1.4E-9
2309978.727 90.6 -0.042 1.7E-6 -1.8E-11 5.2E-12
9649012.623 42.9 -0.091 4.4E-6 -9.4E-12 2.9E-11
17007787.98 319.5 4.6 -0.000023 2.7E-10 -2E-11

°°°

Now that the inverse has been tested against an independent implementation
and shown to work and have good accuracy, the direct will be tested by
combining the result of the two and comparing output to input.
The results:
R(m) A(deg) dR(mm) dA(sec) dR÷R dA÷A
22.034 334.6 -0.0012 0.00022 -5.5E-8 1.8E-10
2068.298 179.9 -0.11 1.3E-6 -5.4E-8 2E-12
2309978.727 90.6 -210 0.00013 -4.6E-8 3.9E-10
9649012.623 42.9 -172 -0.0006 -7.5E-9 -3.8E-9
17007787.98 319.5 -610 0.0023 -1.8E-8 2E-9
"

Also bear in mind that Vincenty had the benefit of 10-12 years of technological advances in computers over Sodano.

However Vincenty's work was based on the availability of FORTRAN, a scalar language. Sodano's was basic mathematics - this tends to age well. :-)

I have transcribed Sodano's paper from a copy I received many years ago into machine readable form (Microsoft Word and hence to a PDF) and did

IIRC, it was thanks to you that I got the Sodano paper.

I could make the full write up of my testing to interested parties as a PDF. I don't have a web site at present.

For those who care, I did my implementation on an IBM ThinkPad T23 and continue to use it on a Lenovo ThinkPad T60.

Ted
.