-
-
Notifications
You must be signed in to change notification settings - Fork 242
Description
I'm trying to compute the earth position (lon/lat) where a satellite and another body line up exactly.
Below i have a found a position on earth at a time when the separation of Mars and ISS are aligned as viewed from Earth:
Time UTC: 2025-05-11T20:12:39Z observer location: 41.319308131976165, -0.8005410706221662 ISS → Altitude: 50.58°, Azimuth: 247.81° Mars → Altitude: 50.58°, Azimuth: 247.81° Separation: 0.000000030723
To find this position, I used a rather heavy iteration that searched and found the lon/ lat position where the separation is 0 to several decimal places. It doesn't always work and takes a lot of iterations to solve.
So I'd really like to improve the process by using vector coordinates. Is there a way that I can take the vector position of Mars, the Vector Position of ISS and join them by a straight line and see where on earth (lon/ lat) the line intersects, such that the separation will always be exactly 0 should I observe the two from earth? How should I approach this so that I get back to the same lon/lat as the example below?
`from skyfield.api import load, EarthSatellite, Topos
Load elements
eph = load('de421.bsp')
ts = load.timescale()
name = "ISS (ZARYA)"
line1 = "1 25544U 98067A 25129.52987991 .00008832 00000+0 16579-3 0 9990"
line2 = "2 25544 51.6373 138.5518 0002579 96.2220 12.6743 15.49431663509168"
iss = EarthSatellite(line1, line2, name, ts)
mars = eph['mars']
Set observer
observer = Topos(latitude_degrees=41.319308131976165, longitude_degrees=-0.8005410706221662)
t = ts.utc(2025, 5, 11, 20, 12, 39.268048)
obs = eph['earth'] + observer
Get alt-az of ISS and Mars
iss_altaz = (iss - observer).at(t).altaz()
mars_altaz = obs.at(t).observe(mars).apparent().altaz()
Get angular separation
iss_position = (iss - observer).at(t)
mars_position = (eph['earth'] + observer).at(t).observe(mars).apparent()
sep = iss_position.separation_from(mars_position).degrees
Print results
print(f"Time UTC: {t.utc_iso()}")
print(f"observer location: {observer.latitude.degrees}, {observer.longitude.degrees}")
print(f"ISS → Altitude: {iss_altaz[0].degrees:.2f}°, Azimuth: {iss_altaz[1].degrees:.2f}°")
print(f"Mars → Altitude: {mars_altaz[0].degrees:.2f}°, Azimuth: {mars_altaz[1].degrees:.2f}°")
print(f"Separation: {sep:.12f}")`