How to find a point in the Earth surface given an origin point, distance and direction (azimuth)

StackOverflow https://stackoverflow.com/questions/1019642

  •  06-07-2019
  •  | 
  •  

Question

The previous question "Geoalgorithm for finding coordinates of point from a known location by distance and bearing" asks the same thing, but the solution found is a rough approximation. I want a more accurate solution. I am comparing the results with the Great Circle Distance formulas, which is one of the best Geographical Distance formulas known.

Was it helpful?

Solution

This is the best formula I have seen so far, from http://www.movable-type.co.uk/scripts/latlong-vincenty-direct.html

a, b = major & minor semiaxes of the ellipsoid   
f = flattening (a−b)/a   
φ1, φ2 = geodetic latitude   
s = length of the geodesic   
α1, α2 = azimuths of the geodesic (initial/final bearing)    

tanU1 = (1−f).tanφ1 (U is ‘reduced latitude’)    
cosU1 = 1/√(1+tan²U1), sinU1 = tanU1.cosU1 (trig identities; §6)     
σ1 = atan2(tanU1, cosα1)    (1)
sinα = cosU1.sinα1  (2)
cos²α = 1 − sin²α (trig identity; §6)    
u² = cos²α.(a²−b²)/b²    
A = 1+u²/16384.{4096+u².[−768+u².(320−175.u²)]} (3)
B = u²/1024.{256+u².[−128+u².(74−47.u²)]}   (4)

σ = s / b.A (1st approximation), σ′ = 2π     
while abs(σ−σ′) > 10-12 { (i.e. 0.06mm)  
        cos2σm = cos(2.σ1 + σ)  (5)
    Δσ = B.sinσ.{cos2σm + B/4.[cosσ.(−1 + 2.cos²2σm) − B/6.cos2σm.(−3 + 4.sin²σ).(−3 + 4.cos²2σm)]} (6)
    σ′ = σ   
    σ = s / b.A + Δσ    (7)
}        
φ2 = atan2(sinU1.cosσ + cosU1.sinσ.cosα1, (1−f).√[sin²α + (sinU1.sinσ − cosU1.cosσ.cosα1)²])    (8)
λ = atan2(sinσ.sinα1, cosU1.cosσ − sinU1.sinσ.cosα1)    (9)
C = f/16.cos²α.[4+f.(4−3.cos²α)]    (10)
L = λ − (1−C).f.sinα.{σ+C.sinσ.[cos2σm + C.cosσ.(−1 + 2.cos²2σm)]} (difference in longitude)    (11)
α2 = atan(sinα, −sinU1.sinσ + cosU1.cosσ.cosα1) (reverse azimuth)   (12)
p2 = (φ2, λ1+L)

OTHER TIPS

How far apart are these two points? I'm a fan of using Gauss-Kruger projections, which works fine if the two points are within 100 nautical miles or so. It has the advantage of letting you work with regular trigonometry in the local space, and then converting that back to Geodetic coordinates.

If they are further apart than that, I fall back on Great Circle, but with the radius of the circle as the radius of curvature of the Earth at a given point along the desired bearing, calculated using the WGS-84 ellipsoid.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top