Skip to content

Body ID Reference

Complete mapping of integer body identifiers used across all pg_orbit functions. Each function family uses its own ID space; the tables below document which IDs are valid for which functions.


Used by planet_heliocentric, planet_observe, and lambert_transfer / lambert_c3.

IDBodyValid for planet_heliocentricValid for planet_observeValid for lambert_*
0SunYes (returns origin)NoNo
1MercuryYesYesYes
2VenusYesYesYes
3EarthYesNoYes
4MarsYesYesYes
5JupiterYesYesYes
6SaturnYesYesYes
7UranusYesYesYes
8NeptuneYesYesYes

The planet ID numbering follows the VSOP87 convention:

  • IDs 1-8 map to the eight planets in order from the Sun
  • No ID is assigned to Pluto (VSOP87 does not include it)
  • The Sun is included as ID 0 for completeness in heliocentric queries
-- Quick lookup: all planet IDs with names
SELECT body_id,
CASE body_id
WHEN 0 THEN 'Sun' WHEN 1 THEN 'Mercury'
WHEN 2 THEN 'Venus' WHEN 3 THEN 'Earth'
WHEN 4 THEN 'Mars' WHEN 5 THEN 'Jupiter'
WHEN 6 THEN 'Saturn' WHEN 7 THEN 'Uranus'
WHEN 8 THEN 'Neptune'
END AS name
FROM generate_series(0, 8) AS body_id;

Used by galilean_observe. Numbered in order of distance from Jupiter, following the Lieske L1.2 convention.

IDMoonDiscovererOrbital PeriodSemi-major Axis
0IoGalileo (1610)1.769 days421,700 km
1EuropaGalileo (1610)3.551 days671,034 km
2GanymedeGalileo (1610)7.155 days1,070,412 km
3CallistoGalileo (1610)16.689 days1,882,709 km
-- All Galilean moon names and IDs
SELECT moon_id,
CASE moon_id
WHEN 0 THEN 'Io' WHEN 1 THEN 'Europa'
WHEN 2 THEN 'Ganymede' WHEN 3 THEN 'Callisto'
END AS name
FROM generate_series(0, 3) AS moon_id;

Used by saturn_moon_observe. Numbered in order of distance from Saturn, following the TASS17 convention.

IDMoonDiscovererOrbital PeriodSemi-major Axis
0MimasHerschel (1789)0.942 days185,539 km
1EnceladusHerschel (1789)1.370 days238,042 km
2TethysCassini (1684)1.888 days294,619 km
3DioneCassini (1684)2.737 days377,396 km
4RheaCassini (1672)4.518 days527,108 km
5TitanHuygens (1655)15.945 days1,221,870 km
6IapetusCassini (1671)79.322 days3,560,820 km
7HyperionBond & Lassell (1848)21.277 days1,481,010 km
SELECT moon_id,
CASE moon_id
WHEN 0 THEN 'Mimas' WHEN 1 THEN 'Enceladus'
WHEN 2 THEN 'Tethys' WHEN 3 THEN 'Dione'
WHEN 4 THEN 'Rhea' WHEN 5 THEN 'Titan'
WHEN 6 THEN 'Iapetus' WHEN 7 THEN 'Hyperion'
END AS name
FROM generate_series(0, 7) AS moon_id;

Used by uranus_moon_observe. Numbered in order of distance from Uranus, following the GUST86 convention.

IDMoonDiscovererOrbital PeriodSemi-major Axis
0MirandaKuiper (1948)1.413 days129,390 km
1ArielLassell (1851)2.520 days190,900 km
2UmbrielLassell (1851)4.144 days266,000 km
3TitaniaHerschel (1787)8.706 days435,910 km
4OberonHerschel (1787)13.463 days583,520 km
SELECT moon_id,
CASE moon_id
WHEN 0 THEN 'Miranda' WHEN 1 THEN 'Ariel'
WHEN 2 THEN 'Umbriel' WHEN 3 THEN 'Titania'
WHEN 4 THEN 'Oberon'
END AS name
FROM generate_series(0, 4) AS moon_id;

Used by mars_moon_observe. Numbered in order of distance from Mars, following the MarsSat convention.

IDMoonDiscovererOrbital PeriodSemi-major Axis
0PhobosHall (1877)0.319 days (7h 39m)9,376 km
1DeimosHall (1877)1.263 days23,463 km
SELECT moon_id,
CASE moon_id
WHEN 0 THEN 'Phobos'
WHEN 1 THEN 'Deimos'
END AS name
FROM generate_series(0, 1) AS moon_id;

Total: 8 planets + 19 moons = 27 solar system bodies computable from SQL.

FunctionID RangeCountTheory
planet_heliocentric0-89VSOP87
planet_observe1-2, 4-87VSOP87
galilean_observe0-34Lieske L1.2
saturn_moon_observe0-78TASS17
uranus_moon_observe0-45GUST86
mars_moon_observe0-12MarsSat
lambert_transfer / lambert_c31-88VSOP87 + Lambert