Reference · Your sky: altitude and azimuth for a place and a moment
horizontalfunction
Where a star (or any J2000 position) stands in the sky of a place on Earth at a moment: its altitude above the horizon and azimuth from north through east. The position is carried from J2000 to the equinox of the date (precess), the hour angle comes from the local mean sidereal time, and the horizon formulas are Meeus's (chapter 13). The result is geometric (no refraction) unless you ask for it. UTC stands for UT; nutation, aberration and parallax are left out, so it is good to about an arc-minute, far finer than the eye. The star's own proper motion is not added: pass starPosition(star, when) if you want it.
Import it
import { horizontal } from "@johnmorrisdotca/hoshi-stars/sky";
Definition
function horizontal(position: SkyPoint, observer: Observer, when: When, options?: HorizontalOptions): Horizontal
Parameters
| Name | Type | Description |
|---|---|---|
position | SkyPoint | A right ascension and declination in degrees, J2000 (the catalogue's frame), or of the date with |
observer | Observer | Latitude north and longitude east in degrees, and optionally |
when | When | The moment, a |
options (optional) | HorizontalOptions |
|
Returns
Horizontal
{ altitude, azimuth } in degrees.
Examples
import { starByName, starPosition } from "@johnmorrisdotca/hoshi-stars";
import { horizontal } from "@johnmorrisdotca/hoshi-stars/sky";
const polaris = starPosition(starByName("Polaris")!);
const view = horizontal(polaris, { latitude: 49.28, longitude: -123.12 }, new Date("2026-11-08T06:00:00Z"));
console.log(view.altitude.toFixed(1)); // 49.8: within a degree of the latitude, 49.2849.8What it prints (run when this page was built)