Finded the straight line distance on the earth By the way, I played with it for a while.
from math import sin, cos, acos, asin, atan2, radians, degrees
def latlng_to_xyz(lat, lng):
rlat, rlng = radians(lat), radians(lng)
coslat = cos(rlat)
return coslat*cos(rlng), coslat*sin(rlng), sin(rlat)
def xyz_to_latlng(x, y, z):
rlat = asin(z)
coslat = cos(rlat)
return degrees(rlat), degrees(atan2(y/coslat, x/coslat))
def halfway_on_sphere(pos0, pos1, z=0.5):
xyz0, xyz1 = latlng_to_xyz(*pos0), latlng_to_xyz(*pos1)
theta = acos(sum(x * y for x, y in zip(xyz0, xyz1)))
sin_th = sin(theta)
v0 = sin(theta * (1-z)) / sin_th
v1 = sin(theta * z) / sin_th
return xyz_to_latlng(*(x * v0 + y * v1 for x, y in zip(xyz0, xyz1)))
Tokyo = 35.68, 139.77
Atlanta = 33.755, -84.39
print(halfway_on_sphere(Tokyo, Atlanta)) # (61.51, -150.67)
I found that the exact middle point between Tokyo and Atlanta was around 40km northwest of the city of Anchorage.
As you can see, the third argument of the halfway_on_sphere
function can be used to calculate any internal division point. You can plot the great circle route by finding the coordinates in small steps. I think the outer equinox can probably be calculated without any problems.