Given a coordinate point X=(lat, lon) and a the centre of a circle C=(lat_center, lon_center) I want to calculate the diametrically opposite coordinates of the point X(assuming that X is inside the circle whose centre is C).
For example, if C=(45.9, 180), the diametrically opposite of X=(45.9, -179) should be (45.9, 179).
the following function is an approximation but does not solve the issue of the latitude being between (-90, 90) and longitude (-180, 180).
def f(lat, lon, center):
lat_center = center[0]
lon_center = center[1]
dist_lon = np.abs(lon - lon_center) if np.abs(lon - lon_center)<180 else 360 - np.abs(lon - lon_center)
dist_lat = np.abs(lat - lat_center) if np.abs(lat - lat_center)<180 else 360 - np.abs(lat - lat_center)
lon_op = lon_center + dist_lon if lon_center + dist_lon != lon else lon_center - dist_lon
lat_op = lat_center + dist_lat if lat_center + dist_lat != lat else lat_center - dist_lat
return np.round(lat_op, 2), np.round(lon_op, 2)