Assuming the earth is a perfect sphere of radius a = 6378 kilometers
diameter, use the algorithm provided below to calculate 100 points on a
geodetic between two points with given latitudes φ1 ; φ2 and longitudes λ1 ;
λ2 . You can find these points in the following way:
1. Convert the latitudes and longitudes into two vectors in cartesian coordinates r1 ; r2 using the following equations for x, y, and z:
x1
sinλ1 cosφ1
x2
rsinλ2 cosφ2
r1 = y1 = rsinλ1 sinφ1 and r2 = y2 = rsinλ2 rsinφ2
z1
rcosλ1
z2
rcosλ2
2. Construct a straight line (through the earth) connecting these two cities
by using parametric equation: r = (1 − t)r1 + tr2 ,and after simplification:
x1 − tx1 + tx2
r = y1 − ty1 + ty2
z1 − tz1 + z2
3. A line through the center of the earth in the direction of r intersects
the great circle. Given this vector r you can find the corresponding
intersection point by calculating the unit vector parallel to r, denoted
r̂ and multiplying it by the radius of the earth a.
To compute the unit vector first you must find the magnitude of vector
r:
p
−
||→
r || = x2 + y 2 + z 2
−
Then you can compute the unit vector parallel to →
r by using the
following equation:
x
→
−
r
r̂ = y = →
−
|| r ||
z
Finally, to find the corresponding intersection point you multiply the
unit vector by the radius of the earth:
1
x
→
−
r
ar̂ = a y = 6378 →
−
|| r ||
z
4. Divide the interval into 100 points tn = {t1 , t2 , t3 , ..., t100 } and calculate
the latitudes and longitudes at these points. These points will not be
equally spaced.
To do this you must first calculate ar̂ for each vector of t ∈ tn , denoted
ar̂tn :
ar̂tn
xtn
−
r→
tn
= ytn = 6378 −
→||
||
r
tn
ztn
Finally you can use the following equations to calculate the latitude
and longitude points for each vector r̂tn :
z
λ = cos−1 p
x2 + y 2 + z 2
φ = tan−1
2
y
x
© Copyright 2026 Paperzz