Planets
VSOP87 and Meeus; Mallama and Hilton for magnitude · checked against USNO, JPL Horizons and Skyfield
What it is
The planets move against the stars, so their places come from a theory of their orbits rather than a catalogue. Each is seen where it was when its light left, minutes to over an hour ago. How bright a planet looks depends on how far it is from the sun and from us, and how much of its lit face we see; Saturn’s rings brighten it by up to 0.8 of a magnitude when they’re open, twice in each 29-year orbit.
- Venus and Jupiter outshine every star, so a night sky drawn without them is wrong where anyone looks first.
- Elongation means what it does for the moon: the planet’s ecliptic longitude minus the sun’s. Under 180° it’s east of the sun, in the evening sky.
- Positions are geometric, as the sun’s and moon’s are: lift them with the star positions page’s refraction.
- Rise, set and transit aren’t here yet.
Operations
| Operation | Gives |
|---|---|
position |
A planet's azimuth and altitude from a placeIn: planet, latitudeInDegrees, longitudeInDegrees, instantUtcOut: azimuthInDegrees, altitudeInDegrees |
phase |
How bright a planet is, how much of it is lit, and how far it is from the sun, at an instantIn: planet, instantUtcOut: visualMagnitude, phaseAngleInDegrees, illuminationFraction, elongationInDegrees |
Fields
| Field | Meaning |
|---|---|
planet | mercury, venus, mars, jupiter or saturn |
latitudeInDegrees | −90 to 90, north positive |
longitudeInDegrees | −180 to 180, east positive |
instantUtc | An instant, ISO 8601 with Z, read as UT1 |
azimuthInDegrees | 0 up to 360, clockwise from north, seen from the place. Left out above 75° altitude. |
altitudeInDegrees | −90 to 90, of the planet's centre, seen from the place (with parallax, under 0.01°), geometric: no refraction |
visualMagnitude | Apparent V magnitude seen from the Earth's centre, by Mallama and Hilton (2018): Saturn with its rings, Mars with its rotation and season terms. Smaller is brighter: Venus near −4.5. |
phaseAngleInDegrees | The Sun–planet–Earth angle: 0 when the face we see is fully lit. Horizons' and a purely geometric one differ by up to 0.008° for Jupiter, within the tolerance. |
illuminationFraction | 0 to 1, the part of the disc that's lit, seen from the Earth's centre |
elongationInDegrees | As for the moon: the planet's apparent ecliptic longitude minus the sun's, seen from the Earth's centre, 0 up to 360. Under 180 it's east of the sun, in the evening sky. Left out within 0.5° of 0, where it wraps. |
Edge cases
| Case | What it tests |
|---|---|
skyfield-position-venus-inferior-conjunction-venusposition | Venus between the Earth and the sun, at its closest: its parallax is largest, about 30″. |
usno-position-mars-opposition-2003-marsposition | Mars at its closest in 60,000 years. |
horizons-phase-venus-inferior-conjunction-2026phase | Venus nearly between us and the sun: a thin crescent past Mallama and Hilton's 163.7° switch, half a degree west of the sun. |
horizons-phase-venus-crescent-2026phase | Venus as a crescent, near its brightest. |
horizons-phase-mercury-crescent-2026phase | Mercury at a large phase angle, where its curve is steepest. |
horizons-phase-mars-opposition-2003phase | Mars at its brightest in 60,000 years. |
horizons-phase-jupiter-quadrature-2026phase | Jupiter's largest phase angle, about 11°. |
horizons-phase-saturn-rings-edge-on-2025phase | Saturn's rings edge on to the Earth: the globe alone. |
horizons-phase-saturn-rings-open-2017phase | Saturn's rings as open as they get, 27°, adding most to its light. |
invalid-position-plutoposition | Only Mercury to Saturn: anything else is invalidInput. |
Their inputs and expected values are in vectors.json; search for the case's id.
For agents
Follow Meeus, Astronomical Algorithms, chapters 32 and 33: the planet and the Earth from VSOP87, truncated, the planet where it was when its light left, annual aberration (23), precession (21), nutation (22) and apparent sidereal time (12), then the place’s parallax (40). Read the instant as UT1. Give the altitude geometric, with no refraction. For phase, the phase angle is at the planet between the sun and the Earth, the illumination is (1 + cos i) / 2, and the magnitude follows Mallama and Hilton (2018): Saturn with its rings, from the Earth’s and the sun’s latitudes over its equator, and Mars with its rotation and season tables from their code, Ap_Mag_V3.f90. Pass every case in vectors.json within its tolerance.
To check by hand against the book, 2nd edition (1998): example 32.a for Venus’s heliocentric place and 33.a for its apparent place. They use Meeus’s own truncation of VSOP87D and work in dynamical time, so they check a step, not a case in this file. Mallama and Hilton’s code comes with three test values for each planet.
Test data
vectors.json holds 278 cases, published 2026-11-22. Earth model: WGS84 latitude and longitude; UT1 read from the UTC given. How to read it: Test data format.
| Operation | Cases |
|---|---|
position |
20455 published · 145 reference · 75 edge · 4 invalid |
phase |
7472 published · 72 reference · 12 edge · 2 invalid |
Tags say where each value came from: what they mean.
| Field | Tolerance |
|---|---|
azimuthInDegrees | ± 0.003 |
altitudeInDegrees | ± 0.003 |
visualMagnitude | ± 0.01 |
phaseAngleInDegrees | ± 0.01 |
illuminationFraction | ± 0.01 |
elongationInDegrees | ± 0.01 |
Every other field is compared exactly.
Implementations
| Implementation | Status |
|---|---|
| gshaw/algorithms-swiftSwift | Passes |
| gshaw/algorithms-typescriptTypeScript | Passes |
Each implementation's CI grades it against this page's test data on every push, and again when the data changes. The code isn't public yet. See how implementations work.
Source
| Position | Astronomical Applications API 4.0.1: Celestial Navigation Data, Hc and ZnUS Naval Observatory, for Mars, Jupiter and Saturn above the horizon. Its Hc is from the Earth's centre, so the altitude is Hc less the parallax it gives. It lists Venus too, but up to 27″ off the disc's centre when Venus is a crescent, so Venus is Skyfield's. Every request and response is in /planets/sources/usno.jsonl · Public domain |
| Magnitude, phase angle and illumination | Horizons On-Line Ephemeris System, observer table quantities 9, 10 and 24, on DE441JPL Solar System Dynamics. APmag, Illu% and S-T-O from the Earth's centre; APmag follows Mallama and Hilton (2018). Every request and response is in /planets/sources/horizons.jsonl · Public domain |
| Position and elongation | Skyfield 1.55 on JPL's DE421Brandon Rhodes. Mercury and Venus, any planet below the horizon, and every elongation. Checked against USNO on every planet it lists. Every call is in /planets/sources/skyfield.txt · MIT |
| Method | Astronomical Algorithms, 2nd edition, 1998, chapters 21 to 23, 32, 33 and 40; Mallama and Hilton, Computing apparent planetary magnitudes for The Astronomical Almanac, 2018Jean Meeus; Anthony Mallama and James L. Hilton. The methods to follow; no value in the file comes from them |