3 ms·
The usual way to do this is to convert latitude and longitude to ECEF (Earth centered, Earth fixed) coordinates.[1] This includes the corrections for the Earth
by Animats 9y ago
The usual way to do this is to convert latitude and longitude to ECEF (Earth centered, Earth fixed) coordinates.[1] This includes the corrections for the Earth being slightly pear-shaped. Then, given 3-element vectors for each point, compute the great circle distance between those points based on simple spherical geometry. This works everywhere, including at the poles.
The FCC formula is based on the old V and H coordinate system that the Bell System used for long distance in the electromechanical era. That was for North America.
There's tons of code out there for this, because every GPS device with a map has to do these calculations.
[1] https://www.mathworks.com/matlabcentral/fileexchange/7942-covert-lat--lon--alt-to-ecef-cartesian?focused=5062966&tab=function&requestedDomain=www.mathworks.com https://www.mathworks.com/matlabcentral/fileexchange/7942-co...
- dbaupp 9y agoIt seems like that won't get the "fast": that code does 4 trigonometric functions and a sqrt while the OPs approximation seems to do one cached trig call and then one sqrt for each point.
- rjeli 9y agoThe standard LLA to ECEF function uses the WGS84 reference ellipsioid, not pear shaped
- afpx 9y agoHuh, why would that work?