Given two GPS points A and B, I would like to compute the GPS coordinates A1 and A2. [A1A2] forms a segment perpendicular to segment [AB].
For this, I start to compute M1, which is the midpoint of [AB] and should be the midpoint of [A1A2].
The distance [A1M1] = [M1A2] = d
My approach consists of finding the distance from A to B using the haversine formula.
from haversine import haversine
A = (lat1, lon1)
B = (lat2, lon2)
dist = haversine(A, B)
Then I get half of it.
half_dist = dist/2
After that, I find the GPS coordinate M1
located on segment [AB], which distance |AM1| = half_dist
For that, I use the approach proposed on this post.
from geographiclib.geodesic import Geodesic
#Define the ellipsoid
geod = Geodesic.WGS84
#Solve the Inverse problem
inv = geod.Inverse(A[0],A[1],B[0],B[1])
azi1 = inv['azi1']
#Solve the Direct problem
dir = geod.Direct(A[0],A[1],azi1,half_dist)
M1 = (dir['lat2'],dir['lon2'])
My difficulty starts here. I don't know how to go on to calculate the coordinates of points A1 and A2 given the distance d.
How can I do this?