brandon-rhodes / python-sgp4

Python version of the SGP4 satellite position library
MIT License
371 stars 87 forks source link

No "ToGeodetic" Method Available (for calculating latitude/longitude from ephemeris)? #23

Closed gbmhunter closed 5 years ago

gbmhunter commented 6 years ago

The sgp4 C++ reference library has a very useful Eci::ToGeodetic() method (see https://github.com/dnwrnr/sgp4/blob/0cc181ee50c707d1a433e97be98de2b925dd78a4/libsgp4/Eci.cpp).

This is very useful for converting a propagated ephemeris into latitude/longitude values. As far as I can see, this functionality does not exist in this python version. Is there any plan to, or was there a specific reason why this was not incorporated?

The Javascript version also has this functionality (https://github.com/shashwatak/satellite-js).

brandon-rhodes commented 6 years ago

My intention was for sgp4 to bring the bare algorithm from the paper into Python, and then to layer more sophisticated routines on top of this library by incorporating it into Skyfield. Which, incidentally, I am adding a to-geodetic routine to this week (yay, finally!). Here's the issue tracking my work:

https://github.com/skyfielders/python-skyfield/pull/42

Is there any chance you could try out Skyfield and see how it works for you? If not, maybe you could snag the routine I wrote for the geodetic work, and pull it into your own project.

gbmhunter commented 6 years ago

Ah o.k., is it the GCRS_to_Topos(xyz, jd) method in skyfield/positionlib.py?

brandon-rhodes commented 5 years ago

Alas, January 2018! I didn’t answer immediately because (if I recall) I was at that moment working on Skyfield’s subpoint() routine but maybe wasn’t done yet. In any case, Skyfield does now support computing the longitude and latitude beneath any sky object:

https://rhodesmill.org/skyfield/api-position.html#skyfield.positionlib.Geocentric.subpoint

Enjoy!

gbmhunter commented 5 years ago

Thank you!