In the most general terms (I'm not asking for the actual calculations), how do popular planetarium apps and software calculate the positions of celestial objects? Planets, for example. Do they use Keplerian formulas with their associated elements and rates, or do they calculate long series of periodic terms as outlined in chapter 32 “Positions of the planets” in Meeus? I'm assuming positions of comets and other small bodies would be calculated from Keplerian orbital elements? I'm also assuming they don't use some sort of numerical integration to calculate positions (as do JPL Horizons)?

  • 4
    $\begingroup$ They generally use VSOP87 due to "good enough" accuracy over a long time period. Meeus has a shortened version in his book. Implementations of the full (and truncated) versions in many languages are available here: github.com/gmiller123456/vsop87-multilang $\endgroup$ Commented Nov 7, 2022 at 14:10
  • $\begingroup$ @GregMiller - So does that mean VSOP87 is more accurate than using Keplarian orbital elements? How about comets, other small bodies and spacecraft? Would they use Keplarian orbital elements for those? Thanks. $\endgroup$
    – Peter
    Commented Nov 7, 2022 at 15:02
  • $\begingroup$ Simple Kepler orbit calculations only work for simple Kepler orbits. ;) You need a more sophisticated approach if you want accurate results when there are more than two interacting bodies. $\endgroup$
    – PM 2Ring
    Commented Nov 7, 2022 at 15:24
  • 4
    $\begingroup$ @Peter, yes VSOP87 is more accurate. Kelperian elements are only useful over a short period of time because it does not account for small effects of other bodies. Planetarium apps use kelperian elements for comets because no better integration exists. For an accurate position they need recent observations, and a file with the latest elements is downloaded from the Minor Planet Center (and some other sources). $\endgroup$ Commented Nov 7, 2022 at 17:03

2 Answers 2


There are quite a few different types of methods of computing the position of celestial objects, and the method used to compute the position generally depends on the type of object and how accurate the application needs to be. I'll list a few types and methods below.

Nebula These are large, distant objects. They generally don't move fast, and are large enough that highly accurate positions are unnecessary and/or difficult to define. So these are generally just static positions from a catalog like the NGC or Messier catalogs.

Stars Distant stars are pinpoints of light, and easy to agree on a location and measure movement, so a star catalog generally includes the position of the star at some epoch, and includes proper motion fields to show how the star moves over time. The exact data is catalog specific. For example, the HIPPARCOS catalog contains the star positions for epoch 1991.25, and proper motion fields specifying their change in RA/Dec from that time.

Planets Lots of methods for computing the planets' positions have been developed because of their importance and popularity.

Keplerian elements are one way, but become inaccurate rather quickly. But the Explanatory Supplement to the Astronomical Almanac supplies elements, and some extra terms to help with accuracy over time. An implementation is here.

VSOP87 is probably the most popular method as it provides good accuracy over a long period of time and doesn't require much storage. Implementations are available in a wide array of languages. This is likely the ephemeris used by pretty much all applications you can download to your PC or phone.

JPL Development Ephemeris are highly accurate, in fact the most accurate available to the public. They are generally produce by the JPL as needed for specific missions. They use Chebyshev polynomials to represent the positions which are only accurate for a very short period (the longest is 32 days), so to cover long time ranges, a lot of these need to be stored. E.g. DE422 covering 3000BC to 3000AD is 500Mb in binary form. Due to their size, and lack of need for such high accuracy from a planetarium program, they are usually only used for specialized applications. I have written an article Format of the JPL Ephemeris explaining how to use them to implement your own, and provided implementations in a few languages.

Artificial Satellites Many planetarium programs also include artificial satellites. These are based on Keplerian elements, but quickly go out of date, so a more complex model is used to adapt the positions called SGP4/SDP4 (and SGP8/SDP8). The algorithm was made public as source code from NORAD in the 80's, and code is available in a multitude of programming languages, but the most thourough ones are available at Celestrak. The elements also need to be updated regularly, and Celestrak provides some of those, but Space-Track is the official source. Programs have to update this file on at least a daily basis to stay up to date.

Comets/asteroids Minor solar system bodies are of enough interest that they are tracked, but not important enough to generate the effort the JPL DE requires. Instead, new Keplerian elements are generated and distributed by the Minor Planet Center. Again, these have to be updated quite regularly, but not necessarily daily, so most apps leave it up to the user to request an update.

Moons The Earth's moon is included in the VSOP87 and JPL DE. And the moons of most planets have chaotic enough orbits that their importance/difficulty tradeoff doesn't justify a specialized ephemeris. But you will find algorithms for some of Jupiter's and Saturn's moons in Meeus' book.

Earth Orientation Parameters are something you didn't ask about, but are quite important to determine where an object will appear in relation to an observer on Earth. Meeus' book covers some of these such as precession, and nutation, and other effects like aberration. But the Explanatory Supplement to the Astronomical Almanac provides a more complete and updated explanation. The USNO provides an example implementation as NOVAS.

You can learn more by looking at the source code for some planetarium programs like Stellarium or Xephem.

  • 2
    $\begingroup$ I belatedly found the Stellarium user guide, which states that planetary positions are found using VSOP87, and lunar positions using something called ELP2000-82B. Google tells me that "ELP 2000-82B is a theory built at the BDL by M. Chapront-Touze and J. Chapront to compute lunar ephemeris." Thanks for your excellent answer. $\endgroup$
    – Peter
    Commented Nov 8, 2022 at 8:17
  • 1
    $\begingroup$ The ELP2000-82B is included in VSOP87A, it was also created at BDL. $\endgroup$ Commented Nov 8, 2022 at 10:14

How do planetarium apps and software calculate positions?

The generic answer is that they use some form of ephemeris. The VSOP87 is an example of an ephemeris. So is JPL Horizons, which uses ephemerides rather than numerical integration. While the ephemerides used by JPL Horizons are calculated using numerical integration, once the data are placed into the form of an ephemeris, numerical integration is no longer needed. JPL Horizons uses ephemerides calculated by other groups at JPL. That they're using ephemerides is why JPL Horizons is so fast.

  • $\begingroup$ I suspect some sites simply use the RESTful interfaces provided by JPL Horizons. $\endgroup$ Commented Nov 7, 2022 at 15:47
  • $\begingroup$ I can get my head around how software/apps could use VSOP87 to find the positions of planets. But how would they find the positions of other things. Is there some sort of equivalent for small bodies? Or do they just calculate a comet's position, for example, by knowing the comet's orbital elements (eccentricity, inclination, semi-major axis, etc)? $\endgroup$
    – Peter
    Commented Nov 7, 2022 at 16:23
  • $\begingroup$ @Peter Keplerin elements are a last resort, but an easy resort. It's very easy to calculate the position at any point in time given Keplerian elements at some epoch time. JPL has multiple ephemerides for the planets and for small bodies in the form of time-based series of Chebyshev polynomial coefficients. Find the right set, and bingo. The calculation is very fast. The lookup and retrieval for the right set will not be as fast, but it still is far faster than integrating the entire solar system from some epoch time. $\endgroup$ Commented Nov 7, 2022 at 16:37
  • $\begingroup$ @Peter Using Kepler elements for comets has a slight problem: if the comet passes close to a major body (apart from the Sun) it will be perturbed. And if its perihelion is close to the Sun it will lose volatiles, which can affect its trajectory. FWIW, Horizons has multiple files for Halley's comet. ssd.jpl.nasa.gov/api/… $\endgroup$
    – PM 2Ring
    Commented Nov 7, 2022 at 16:45
  • $\begingroup$ @Peter From ssd.jpl.nasa.gov/horizons/manual.html#select "Small-bodies have their statistically estimated position and velocity at one instant compactly stored in a database as initial conditions and are then numerically integrated on-demand by Horizons, to other times of interest". Note that they're only integrating the small body, so it's fairly quick. The necessary major body position are just pulled from the ephemerides. $\endgroup$
    – PM 2Ring
    Commented Nov 7, 2022 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .