Reference · Your sky: altitude and azimuth for a place and a moment
horizontalFromfunction
Where a star stands in the sky of a place on ANOTHER planet: the sky turns about that planet's pole (the IAU WGCCRE pole and prime meridian, passed in as spin), so the star is rotated into the planet's own equatorial frame, its hour angle is the prime meridian plus the observer's east longitude minus its right ascension there, and the horizon formulas are the same as for Earth.
The stars look the same from every planet: the nearest star, Proxima Centauri, shifts only about 40 arc-seconds seen from Pluto (annual parallax 0.77 arc-seconds times Pluto's 49 AU at its farthest), and a typical star far less, so a star's J2000 position serves anywhere in the solar system. Only the pole and the turning change.
Limits: the latitude is used as the angle from the planet's equator on a sphere (the difference between planetographic and planetocentric latitude, up to a fifth of a degree on Mars, is ignored); the pole's slow drift is the caller's to add in if wanted (spin.pole is read as given); there is no atmosphere, and no precession of the pole is applied. when is UTC, like every moment in the package: it is turned into Terrestrial Time inside, the scale the IAU rates are in (69.184 s ahead of UTC since 2017, by the leap-second table back to 1972 and by Espenak and Meeus's delta T before it; a leap second announced after 2017 is not known until the table gets its row). TDB differs from TT by under 2 milliseconds, which is ignored. Without the conversion Mars would be turned 0.28 degrees out.
Import it
import { horizontalFrom } from "@johnmorrisdotca/hoshi-stars/sky";
Definition
function horizontalFrom(position: SkyPoint, spin: PlanetSpin, observer: Observer, when: When): Horizontal
Parameters
| Name | Type | Description |
|---|---|---|
position | SkyPoint | A right ascension and declination in degrees at J2000. |
spin | PlanetSpin | The planet's |
observer | Observer | Latitude north and longitude east on that planet, in degrees (north being the side of the pole). |
when | When | The moment, a |
Returns
Horizontal
{ altitude, azimuth } in degrees, the azimuth from north through east.
Examples
import { starByName, starPosition } from "@johnmorrisdotca/hoshi-stars";
import { horizontalFrom } from "@johnmorrisdotca/hoshi-stars/sky";
// Mars, IAU 2015 values: its north celestial pole is only 10 degrees from Deneb, so from the pole Deneb stands almost overhead
const mars = { pole: { rightAscension: 317.269202, declination: 54.432516 }, primeMeridian: { w0: 176.049863, rate: 350.891982443297 } };
const deneb = starPosition(starByName("Deneb")!);
console.log(horizontalFrom(deneb, mars, { latitude: 90, longitude: 0 }, Date.UTC(2026, 10, 8)).altitude.toFixed(1)); // 79.879.8What it prints (run when this page was built)