I know it is not that hard for those familiar with the equations for it, but I am having trouble with the math. In order to fully understand the orbit elements of TLEs I read this which I found very helpful, but I am struggling with turning that into latitude and longitude coordinates. I am coming into this with no knowledge of the necessary algorithms which is what I am hoping someone can point me to. This post provides some relevant information but if I understand correctly is only explaining how to get the longitude at a specific time while I would like the full coordinates.
-
2$\begingroup$ Please put the full information from linked sites into your post to prevent link obsolescence ("rot"). What part of SGP/SDP algorithms does present difficulties for you? $\endgroup$– Deer HunterCommented Apr 7, 2014 at 23:36
-
$\begingroup$ The information in the first link would be hard to summarize here but I added a bit to the second one. I also elaborated on what I am asking for. I don't understand what equations/algorithms are used to determine a satellites position at a certain time based on its TLE data, and that's what I would like to know. $\endgroup$– harryisaacCommented Apr 8, 2014 at 0:43
-
$\begingroup$ celestrak.com/publications/AIAA/2006-6753 Please search for SGP4/SDP4 algorithms on the Web. Note: the above link leads to annotated source code (celestrak.com/publications/AIAA/2006-6753/AIAA-2006-6753.zip). $\endgroup$– Deer HunterCommented Apr 8, 2014 at 0:49
-
$\begingroup$ Could someone elaborate a little more about how to do it? @harry1795671: How did you use that Pyephem library? $\endgroup$– QorzykingCommented Oct 5, 2014 at 12:30
-
$\begingroup$ @Qorzyking Please note we're not a discussion forum but a Q&A site. If you have a new question please ask it as such. Refer to our About and Help center pages for more information how we function and organise things on Stack Exchange that Space Exploration is a part of. Thanks! $\endgroup$– TildalWaveCommented Oct 5, 2014 at 12:51
4 Answers
you can use PyEphem just like this
sudo apt-get install python
sudo apt-get install python-dev
sudo apt-get install python-pip
pip install pyephem
create test.py:
import ephem
import datetime
## [...]
name = "ISS (ZARYA)";
line1 = "1 25544U 98067A 12304.22916904 .00016548 00000-0 28330-3 0 5509";
line2 = "2 25544 51.6482 170.5822 0016684 224.8813 236.0409 15.51231918798998";
tle_rec = ephem.readtle(name, line1, line2);
tle_rec.compute();
print tle_rec.sublong, tle_rec.sublat;
-
1$\begingroup$ Very nice! It's always good to see Python here. Skyfield is another Python package, and has a tag here where some use examples can be found. It is based on different principles, but has some overlapping functionality. Both PyEphem and Skyfield are in fact managed by the same person. $\endgroup$– uhohCommented Mar 13, 2017 at 7:32
-
1$\begingroup$ Now, I want to forecast orbit.what should I do?Just like this, input a time, output a longitude and latitude. @uhoh Have you something idea? $\endgroup$– U2647Commented Mar 13, 2017 at 9:45
-
$\begingroup$ Ya, the reason I didn't post another answer is that it does not appear to be so transparent to generate a ground track from an orbit in Skyfield. It's easy to get GCRS coordinates (x, y, z) or JD2000 coordinates, but if I understand correctly it's still up to the user to project down on to their own model for the Earth. Lat/lon are referenced to the Earth's surface, they are not necessarily precise space coordinates. If you ask this as another question here I can post short scripts for two different methods. $\endgroup$– uhohCommented Mar 13, 2017 at 10:36
-
$\begingroup$ In the mean time, you can look at this question and Skyfield issue 121. $\endgroup$– uhohCommented Mar 13, 2017 at 10:38
-
$\begingroup$ Warning: pyephem is deprecated and no longer maintained (last release was in 2015). Skyfield however had most recent released February 2019 (4 months prior to this comment). $\endgroup$– gerritCommented Jun 5, 2019 at 13:51
There are a number of software packages, many of them free, that deal with those two line elements. Use one of them.
Those two line elements are not Keplerian elements. They are instead Brouwer-Lyddane mean orbital elements. Keplerian elements assume a spherical central body and no forces other than gravitation. The Brouwer-Lyddane mean orbital elements address the first six spherical harmonics and attempt to account for atmospheric drag. The mathematics of Keplerian elements is a bit messy. The mathematics of those two line elements is beyond messy. It's a "math-out". (Think of a blizzard where all you see is whiteness. Blizzards are white-out conditions. The paper describing the two line elements is a math-out. All you see is mathematics.)
The mathematics is described in F.R. Hoots, "Reformulation of the Brouwer geopotential theory for improved computational efficiency", Celestial Mechanics 24 (1981).
-
$\begingroup$ In the end I settled on using Pyephem, a python library capable of doing the calculations fairly easily. $\endgroup$ Commented May 8, 2014 at 21:11
Depending on which algorithm/set of equations you are using to convert, you may need to convert the TLE parameters into ECEF coordinates, then convert that into latitude, longitude, and altitude. Here is a page that explains the ECEF-to-LLA conversion: http://www.gmat.unsw.edu.au/snap/gps/clynch_pdfs/coordcvt.pdf
A common math difficulty is that the true anomaly and the mean anomaly are related by Kepler's equation, which is a transcendental equation as your first link mentioned. An iterative method like Newton's Method is usually used for this part of the conversion.
I can't seem to find a webpage that has the set of algorithms for converting TLE to ECEF, but this page gives the algorithm for converting GPS ephemerides (orbital parameters) into ECEF coordinates: http://web.ics.purdue.edu/~ecalais/teaching/geodesy/EAS_591T_2003_lab_4.htm If I remember correctly the TLE conversion is pretty similar, so that might get you on the right track. If you don't have a textbook with the algorithm, it might be online in a paper or something.
-
1$\begingroup$ Please expand and include the relevant math for the benefit of subsequent visitors. $\endgroup$ Commented Apr 8, 2014 at 0:52
-
2$\begingroup$ Note: the first link is now dead. $\endgroup$– TristanCommented Mar 13, 2017 at 14:08
I had a similair question, and using pyephem as suggested by zdRan worked great, except for one thing: Those are instructions for Debian/Ubuntu/etc. distributions and I was on a bare-bones CentOS install.
In case anyone else runs into this, here's the install instructions, to be used in place of the first block in zdRan's post:
sudo yum install python
sudo yum install python-devel
sudo yum upgrade python-setuptools
sudo yum install epel-release
sudo yum install python-pip
sudo yum install gcc
sudo pip install pyephem
The epel-release
is needed since pip isn't part of the core pacakges for CentOS, but is part of the extended packages. gcc
only needs to be installed if you don't already have it (you can use whereis gcc
to check, but yum won't install if already there, so not strictly necessary).
From there, proceed as above, works great.
(This was on CentOS 7, but a similair procedure should work for most CentOS/Red Hat/Fedora distributions)