This function uses the Vincenty direct algorithm to solve the "forward geodesic problem," which is the problem of computing the endpoint of a geodesic (shortest-distance) path on the ellipsoidal earth, given the start point, a path length, and a starting azimuth. This process is also called "reckoning."
In 1975, Vincenty published a rapidly converging algorithm for this calculation. Since then, his algorithm has since seen significant implementation in geodesy and engineering. The algorithm is precise to within a few millimeters. Please see code comments for references.
I am having trouble producing the correct results using this submission. Over the past few days I have been trying to code my own program similar to this one and for a test point I kept getting the wrong answer. I eventually came across your code and it also gave the same answer my code gave for the test point. I have checked Google Earth and even the website that uses a Javascript to calculate the latitude and longitude of a point given a distance, bearing, and an initial point.
To illustrate my problem I have the following initial point latitude and longitude:
39° 44′ 42.41″N
105° 00′ 5.01″W
or
39.74511389
105.0013916667
And the following distance (meters)
23.14288153 meters
And the following bearing
319°24′ 0″
or
319.4
Now when I send these values to the function you developed I get:
>> [x y] = vreckon(lat1, lon1, s, a12)
x =
39.7452721501884
y =
105.001215949306
Now the value I get using the Javascript from the following website (http://www.movable-type.co.uk/scripts/latlong-vincenty-direct.html) is:
39°44′42.9797″N
105°00′05.6426″W
or
39.74527214
105.0015674
As can be seen the latitude value matches well, but the longitude is far off. On that website the author even gives the code (using the same formulas you used) for the Javascript so I wasn't sure where the difference could be. Finally, I checked Google Earth and the latitude and longitude produced by the aforementioned website are the correct values. I believe the problem lies in using the "mod" function (my code uses it as well), but again I'm not sure.
Could you perhaps provide some insight into this problem? It would be of great help for my project where accuracy is a issue. Thanks.
Kevin Ellis
27 Nov 2007
R Calabretta
Very useful tool for evaluating Required Navigation Performance (RNP) algorithms.
Thank you Michael. I appreciate the work you are doing in this area.