<blockquote>
<p>How do planetarium apps and software calculate positions?</p>
</blockquote>
<p>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.</p>

CC BY-SA 4.0
2022-11-07T15:47:50.340Z
I suspect some sites simply use the RESTful interfaces provided by JPL Horizons.
David Hammen
CC BY-SA 4.0
2022-11-07T16:23:04.083Z
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)?
Peter
CC BY-SA 4.0
2022-11-07T16:37:50.140Z
@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.
David Hammen
CC BY-SA 4.0
2022-11-07T16:45:10.697Z
@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.  https://ssd.jpl.nasa.gov/api/horizons.api?format=text&MAKE_EPHEM=NO&COMMAND=Halley
PM 2Ring
CC BY-SA 4.0
2022-11-07T16:45:38.760Z
@Peter From https://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.
PM 2Ring
CC BY-SA 4.0
2022-11-07T16:59:01.313Z
I should have been clearer in my question I understand that JPL Horizons is super accurate. I was asking about stand-alone apps such as Stellarium, Sky Map and Sky Safari. How (in general terms) would they calculate, for example, the orbit of a comet? I'm assuming these apps don't "ask a friend" in the sense of asking JPL Horizons for the correct data? Thanks.
Peter
CC BY-SA 4.0
2022-11-07T22:32:38.137Z
@Peter [GregMiller's answer](https://astronomy.stackexchange.com/a/50991/7982) addresses comets and asteroids, including ones recently discovered and those that will then only pass near the Sun once. The software will likely use an internet connection to check either the  Minor Planet Data Center website itself, or some other site that draws from the MPDC to update its internal [ephemerides](https://english.stackexchange.com/q/370655/217285) for the new objects.
uhoh
CC BY-SA 4.0
2022-11-08T05:22:05.203Z
@DavidHammen VSOP87 is not an ephemeris; DE438 is one, calculated by JPL. VSOP87 (and VSOP2000 and 2010 and 2013 after it) is an analytical solution; it’s a set of mathematical terms to add, from multiplications of sines and cosines. It’s really a calculation that has to be done, whereas with DE438 you just lookup the date in the database and find in there the position (maybe there’s some interpolation to do, I’m not 100% sure).
Pierre Paquette
CC BY-SA 4.0
2022-11-07T15:38:17.663Z
2022-11-07T15:38:17.663Z
David Hammen
<p>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.</p>
<p><strong>Nebula</strong>
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 <a href="https://github.com/mattiaverga/OpenNGC" rel="noreferrer">NGC</a> or <a href="https://en.wikipedia.org/wiki/Messier_object" rel="noreferrer">Messier</a> catalogs.</p>
<p><strong>Stars</strong>
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 <em>proper motion</em> fields to show how the star moves over time.  The exact data is catalog specific.  For example, the <a href="https://heasarc.gsfc.nasa.gov/W3Browse/all/hipparcos.html" rel="noreferrer">HIPPARCOS</a> catalog contains the star positions for epoch 1991.25, and proper motion fields specifying their change in RA/Dec from that time.</p>
<p><strong>Planets</strong>
Lots of methods for computing the planets' positions have been developed because of their importance and popularity.</p>
<p><em>Keplerian elements</em> 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 <a href="https://www.celestialprogramming.com/planets_with_keplers_equation.html" rel="noreferrer">here</a>.</p>
<p><em>VSOP87</em> is probably the most popular method as it provides good accuracy over a long period of time and doesn't require much storage.  <a href="https://github.com/gmiller123456/vsop87-multilang" rel="noreferrer">Implementations</a> 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.</p>
<p><em>JPL Development Ephemeris</em> 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 <a href="https://www.celestialprogramming.com/jpl-ephemeris-format/jpl-ephemeris-format.html" rel="noreferrer">Format of the JPL Ephemeris</a> explaining how to use them to implement your own, and provided <a href="https://github.com/gmiller123456/jpl-development-ephemeris" rel="noreferrer">implementations in a few languages</a>.</p>
<p><strong>Artificial Satellites</strong>
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 <a href="http://celestrak.org/software/vallado-sw.php" rel="noreferrer">Celestrak</a>.  The elements also need to be updated regularly, and Celestrak provides some of those, but <a href="https://www.space-track.org/" rel="noreferrer">Space-Track</a> is the official source.  Programs have to update this file on at least a daily basis to stay up to date.</p>
<p><strong>Comets/asteroids</strong>
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 <a href="https://www.minorplanetcenter.net/iau/Ephemerides/CritList/Soft00CritList.txt" rel="noreferrer">Minor Planet Center</a>.  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.</p>
<p><strong>Moons</strong>
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.</p>
<p><strong>Earth Orientation Parameters</strong>  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 <a href="https://aa.usno.navy.mil/software/index" rel="noreferrer">NOVAS</a>.</p>
<p>You can learn more by looking at the source code for some planetarium programs like <a href="https://stellarium.org/" rel="noreferrer">Stellarium</a> or <a href="https://xephem.github.io/XEphem/Site/xephem.html" rel="noreferrer">Xephem</a>.</p>

CC BY-SA 4.0
2022-11-08T08:17:56.887Z
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.
Peter
CC BY-SA 4.0
2022-11-08T10:14:50.893Z
The ELP2000-82B is included in VSOP87A, it was also created at BDL.
Greg Miller
CC BY-SA 4.0
2022-11-07T18:33:25.100Z
2022-11-07T18:38:54.593Z
2022-11-07T18:38:54.593Z
Greg Miller
<p>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)?</p>

CC BY-SA 4.0
2022-11-07T14:10:30.050Z
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: https://github.com/gmiller123456/vsop87-multilang
Greg Miller
CC BY-SA 4.0
2022-11-07T15:02:32.920Z
@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.
Peter
CC BY-SA 4.0
2022-11-07T15:24:46.317Z
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.
PM 2Ring
CC BY-SA 4.0
2022-11-07T17:03:33.003Z
@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).
Greg Miller
<positional-astronomy><ephemeris>
How do planetarium apps and software calculate positions?
Peter
# How do planetarium apps and software calculate positions?

(Asked by: username_0 on 2022-11-07)

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)?

**Tags:** positional-astronomy, ephemeris
> **Comments:**
> **username_1**: 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: https://github.com/gmiller123456/vsop87-multilang  
> **username_0**: @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.  
> **username_2**: 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.  
> **username_1**: @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).  

---

## 2 answers

### Answer by username_1 on 2022-11-07. Score: 23 | Accepted answer

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](https://github.com/mattiaverga/OpenNGC) or [Messier](https://en.wikipedia.org/wiki/Messier_object) 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](https://heasarc.gsfc.nasa.gov/W3Browse/all/hipparcos.html) 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](https://www.celestialprogramming.com/planets_with_keplers_equation.html).

*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](https://github.com/gmiller123456/vsop87-multilang) 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](https://www.celestialprogramming.com/jpl-ephemeris-format/jpl-ephemeris-format.html) explaining how to use them to implement your own, and provided [implementations in a few languages](https://github.com/gmiller123456/jpl-development-ephemeris).

**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](http://celestrak.org/software/vallado-sw.php). The elements also need to be updated regularly, and Celestrak provides some of those, but [Space-Track](https://www.space-track.org/) 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](https://www.minorplanetcenter.net/iau/Ephemerides/CritList/Soft00CritList.txt). 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](https://aa.usno.navy.mil/software/index).

You can learn more by looking at the source code for some planetarium programs like [Stellarium](https://stellarium.org/) or [Xephem](https://xephem.github.io/XEphem/Site/xephem.html).

> **Comments:**
> **username_0**: 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.  
> **username_1**: The ELP2000-82B is included in VSOP87A, it was also created at BDL.  

---

### Answer by username_3 on 2022-11-07. Score: 12

> 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.

> **Comments:**
> **username_3**: I suspect some sites simply use the RESTful interfaces provided by JPL Horizons.  
> **username_0**: 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)?  
> **username_3**: @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.  
> **username_2**: @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.  https://ssd.jpl.nasa.gov/api/horizons.api?format=text&MAKE_EPHEM=NO&COMMAND=Halley  
> **username_2**: @Peter From https://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.  
> **username_0**: I should have been clearer in my question I understand that JPL Horizons is super accurate. I was asking about stand-alone apps such as Stellarium, Sky Map and Sky Safari. How (in general terms) would they calculate, for example, the orbit of a comet? I'm assuming these apps don't "ask a friend" in the sense of asking JPL Horizons for the correct data? Thanks.  
> **username_4**: @Peter [GregMiller's answer](https://astronomy.stackexchange.com/a/50991/7982) addresses comets and asteroids, including ones recently discovered and those that will then only pass near the Sun once. The software will likely use an internet connection to check either the  Minor Planet Data Center website itself, or some other site that draws from the MPDC to update its internal [ephemerides](https://english.stackexchange.com/q/370655/217285) for the new objects.  
> **username_5**: @DavidHammen VSOP87 is not an ephemeris; DE438 is one, calculated by JPL. VSOP87 (and VSOP2000 and 2010 and 2013 after it) is an analytical solution; it’s a set of mathematical terms to add, from multiplications of sines and cosines. It’s really a calculation that has to be done, whereas with DE438 you just lookup the date in the database and find in there the position (maybe there’s some interpolation to do, I’m not 100% sure).  

---

