I need to calculate the distance between two lat/lng coordinate pairs. In addition, If given an initial lat/lng coordinate, angle of travel, and distance, I need to calculate the resulting lat/lng coordinate.
- $f(lat1, lng1, lat2, lng2) = what (angle, distance)$
- $f(lat1, lng1, angle, distance) = what (lat1, lng1)$
I come from a programming background so please bear with my lack of exposure to math notation.
Here is a jsfiddle which appears to work: as you can see, I tested it by feeding the output of one function into the other. The azimuth ("angle" in your notation) is calculated as described in Wikipedia. The second function assumes that the trajectory of motion is an arc of a great circle (aka geodesic, aka shortest path on the sphere). In particular, this means that starting in London and going initially to the east (azimuth 90 degrees), you will actually be going southeast soon. If one maintained constant azimuth during the travel, the resulting trajectory would not be a geodesic but a loxodromic curve.
In case something happens to jsfiddle, here is the code. (By the way, I am sure that this particular problem has been solved many times, in various languages and in better ways than I did here.)