How do hour angle and declination locate a body in your sky?
Use your geographical latitude, the body's declination and its local hour angle to transform an equatorial direction into a horizon direction. Altitude h measures above or below the horizon. Azimuth A, in this guide, runs clockwise from true north: north 0°, east 90°, south 180° and west 270°. The transformation needs both an angular position around the sky and a position north or south of the equator.
Right ascension alone does not tell you where to look. The Earth has rotated by a different amount at different times, and observers at different locations have different local horizons. Local sidereal time and your longitude connect the equatorial coordinate to that local situation.
The worked model below uses a fixed declination of +20° and latitude of +30°. It describes invented directions with no atmospheric refraction. It is not a dated solar or lunar forecast and is not a navigation solution.
Choose the signs, units and north direction before calculating
Let φ be geographical latitude, positive north. Let λ be geographical longitude, positive east. This λ is the observer's longitude on Earth; it is not the ecliptic longitude used in the equatorial-coordinate guide. Reusing a familiar Greek letter does not make the two quantities interchangeable.
Declination δ is positive north of the celestial equator. Hour angle H is positive west of the local meridian in this convention. Negative H places the direction on the eastern half of its diurnal circle; positive H places it on the western half, except at the equivalent boundary directions.
Our azimuth uses true north, not magnetic north. Some software measures azimuth from south or increases it in another direction. Copy the convention as well as the number when comparing results. A correct answer in another convention can differ by 180° or have an opposite sign.
Calculate local hour angle from sidereal time
Following the US Naval Observatory's horizon-coordinate explanation, with Greenwich apparent sidereal time and RA in hours and longitude in degrees:
H = 15 × (GAST − RA) + λeast
Alternatively, calculate local sidereal time as GAST + λeast/15, then subtract RA and convert the resulting angular hours to degrees. These are two ways of doing the same arithmetic. Do not add a geographical longitude in degrees directly to a sidereal time in hours.
| GAST: hours | RA: hours | East-positive longitude: degrees | Raw H: degrees | Wrapped H: degrees |
|---|---|---|---|---|
| 8 | 10 | 45 | 15 | 15 |
| 8 | 10 | -45 | -75 | -75 |
| 23.5 | 1 | 30 | 367.5 | 7.5 |
| 6 | 6 | 0 | 0 | 0 |
| 0 | 12 | 0 | -180 | -180 |
The first row has GAST 8h, RA 10h and longitude 45° east. Local sidereal time is 11h, so the direction is one angular hour, or 15°, west of the meridian. Changing the location to 45° west gives H = −75°. The difference comes from longitude, not from changing the body's RA.
A wrapped value of 7.5° in the third row is equivalent to the raw 367.5°. The chosen signed display interval is −180° ≤ H < 180°. A value exactly at the endpoint may be written as −180° or +180° if that convention is stated.
Build east, north and up components
A vector form makes the direction conventions visible and handles the azimuth quadrant directly. For an input direction of unit length, define:
E = −cos δ sin H
N = sin δ cos φ − cos δ cos H sin φ
U = sin δ sin φ + cos δ cos H cos φ
Then obtain h = atan2(U, √(E² + N²)) and A = atan2(E, N), with A normalized into 0° ≤ A < 360°. Most programming languages use atan2(y, x), so the azimuth call deliberately supplies east first and north second. Check the argument order in the library you use.
The altitude formula is equivalent to sin h = sin δ sin φ + cos δ cos φ cos H. The vector formulation also keeps the horizontal direction available. A plain arctangent of E/N loses quadrant information and fails to distinguish opposite directions with the same ratio.
All trigonometric inputs must share the expected unit. In code, convert degrees to radians before sin, cos or atan2 and convert inverse-function outputs back to degrees. The formulas change coordinate orientation; they do not add atmosphere or move the observer's origin.
A complete track for latitude 30° north and declination 20° north
| H: degrees | Altitude h: degrees | Azimuth A: degrees | East E | North N | Up U |
|---|---|---|---|---|---|
| -180 | -40.000000 | 0.000000 | 0.000000 | 0.766044 | -0.642788 |
| -135 | -23.855525 | 46.596441 | 0.664463 | 0.628430 | -0.404432 |
| -90 | 9.846552 | 72.504759 | 0.939693 | 0.296198 | 0.171010 |
| -45 | 48.283961 | 93.104071 | 0.664463 | -0.036033 | 0.746452 |
| 0 | 80.000000 | 180.000000 | 0.000000 | -0.173648 | 0.984808 |
| 45 | 48.283961 | 266.895929 | -0.664463 | -0.036033 | 0.746452 |
| 90 | 9.846552 | 287.495241 | -0.939693 | 0.296198 | 0.171010 |
| 135 | -23.855525 | 313.403559 | -0.664463 | 0.628430 | -0.404432 |
| 180 | -40.000000 | 0.000000 | 0.000000 | 0.766044 | -0.642788 |
At H = 0°, E is zero and N is negative: the direction is due south. Its altitude is 80°. At H = −45°, E is positive, so the direction is on the eastern side; at +45°, E is negative and it is on the western side. The two altitudes match because cosine is even, while the azimuths distinguish the sides.
At H = ±90°, altitude is still about +9.847°, not zero. Six angular hours from the meridian do not generally identify rising or setting. The declination and observer latitude determine where the track crosses the horizon.
At ±180°, the model gives altitude −40° and azimuth 0°. This is the same lower-meridian direction written at both ends of the hour-angle interval. A negative altitude is a mathematically valid direction below the ideal horizon; it is not an invitation to treat the object as observable there.
See how altitude and horizontal components change together
The top panel has 361 samples from H = −180° through +180°. The lower panel shows E and N at the same samples. Positive E means an eastward component; negative E means westward. Positive N means northward and negative N southward. Both are dimensionless components of a unit vector.
The lower panel intentionally shows components rather than joining azimuth labels across 360° and 0°. Those labels mark the same north direction, so a plotted numerical jump would not represent a sudden movement of the body. The components remain continuous throughout this model.
The horizontal axis describes angular position relative to the local meridian. Turning it into a civil-time schedule requires an epoch, sidereal-time calculation and appropriate changes in the body's equatorial coordinates. The Moon in particular should not be frozen at one declination and RA for an entire real observing day.
Meridian crossings can be north, south or directly overhead
| φ (°) | δ (°) | H (°) | h (°) | A (°) |
|---|---|---|---|---|
| 30 | -20 | 0 | 40.000000 | 180.000000 |
| 30 | 20 | 0 | 80.000000 | 180.000000 |
| 30 | 30 | 0 | 90.000000 | undefined |
| 30 | 60 | 0 | 60.000000 | 0.000000 |
| 30 | -30 | 180 | -90.000000 | undefined |
The first two rows put the upper-meridian direction south of the observer's zenith. When δ = +60° at latitude +30°, the upper-meridian direction is north instead. “Crossing the meridian” therefore does not universally mean “due south.” Check the north component rather than imposing that assumption.
At φ = δ = +30° and H = 0°, the direction is exactly at the zenith. Altitude is 90°, but azimuth is undefined: there is no horizontal direction to point toward. At the nadir, altitude −90° has the same azimuth problem. A display should distinguish an undefined value from a valid north bearing of zero.
Near the zenith, a small change of direction can produce a large change in azimuth. This is a coordinate singularity, not necessarily rapid physical motion or a faulty telescope. Altitude and the full vector give the context needed to interpret the bearing.
The same hour angle gives different local directions at different latitudes
| φ (°) | h (°) | A (°) |
|---|---|---|
| -30 | 23.855525 | 46.596441 |
| 0 | 41.641143 | 62.763687 |
| 30 | 48.283961 | 93.104071 |
| 60 | 38.934359 | 121.327185 |
These rows keep the celestial declination and hour angle fixed. Only the observer's latitude changes. Each observer has a different horizon plane, so altitude and azimuth change together. This is why a sky-position screenshot from another city is not automatically a pointing instruction for your location.
Longitude and latitude play different roles in this calculation. Longitude enters the construction of local hour angle from Greenwich sidereal time; latitude enters the horizon rotation. If H has already been computed for the location, adding longitude again inside the altitude formula would count that location adjustment twice.
Changing the observer's location can also change the input direction through parallax for nearby bodies. This table isolates the orientation of the horizon while holding the input direction fixed. It does not claim to include that additional displacement effect.
Reverse the transformation as an independent check
Starting from h and A in the stated north-clockwise convention, reconstruct E = cos h sin A, N = cos h cos A and U = sin h. Then recover the equatorial quantities using:
sin δ = N cos φ + U sin φ
cos δ cos H = U cos φ − N sin φ
cos δ sin H = −E
Use the first expression for δ and atan2 of the third and second expressions for H. For the regular rows of the track, the recovered declination should be +20° and the recovered H should match the input modulo a full circle. At a celestial pole, H itself is undefined, so apply this angle check away from that singular case.
Also check E² + N² + U² = 1. A rotation preserves a unit vector's length. This catches some transcription mistakes without using the same altitude formula twice. The checks establish consistency of the geometry, not the accuracy of the astronomical coordinates supplied to it.
Keep the reference frame and observational corrections explicit
GAST is apparent sidereal time. Pair it with equatorial coordinates prepared for the corresponding apparent reference, rather than silently combining a catalog's J2000 mean coordinates with an apparent-of-date time. Precession, nutation and other preparation steps belong upstream of this simple local rotation when the application requires them.
The transformation also cannot turn geocentric lunar coordinates into topocentric ones merely by inserting the observer's latitude. A nearby body's direction may require a separate parallax treatment. A solar or lunar limb event additionally needs an explicit choice of center or limb and any semidiameter correction.
The USNO navigation-data description lists refraction, semidiameter and parallax as separate corrections. That is a useful reminder to identify each contribution instead of hiding them inside an unexplained “adjusted altitude.” The refraction guide explains the geometric-to-apparent altitude distinction.
A worksheet for a reproducible result
- Record the observation instant, location, RA, declination and coordinate reference.
- Use matching sidereal-time conventions and write east-positive longitude explicitly.
- Calculate H with hours and degrees separated, then normalize it consistently.
- Calculate E, N and U, and recover altitude and north-clockwise azimuth with atan2.
- Check vector length, the inverse transformation and whether azimuth is undefined.
- List any separate refraction, parallax or limb corrections before comparing with an observation.
The sidereal-time guide supplies background for the time input. For local solar events, use the Sun tool with its location and date; the teaching table here is a geometry exercise rather than a replacement for that dated calculation.
Frequently asked questions
What is local hour angle?
It is the body's angular position relative to the local meridian. In this guide it increases westward and equals 15 × (GAST − RA) plus east-positive geographical longitude when the times are in hours.
Which azimuth convention does this guide use?
Clockwise from true north: north 0°, east 90°, south 180° and west 270°. Another program may use a different zero or direction, so compare conventions first.
Does an hour angle of 90° always mean sunset or moonset?
No. In the declared latitude +30°, declination +20° example, the altitude at ±90° hour angle is about +9.847°. Horizon crossings depend on both latitude and declination.
Why is azimuth undefined directly overhead?
At the zenith the horizontal projection has zero length, so no unique north/east bearing exists. Altitude remains 90°. An undefined bearing should not be displayed as an ordinary north bearing.
Does this calculation include atmospheric refraction?
No. The model rotates an input direction into the local horizon frame. Refraction, parallax, limb choice and reference-frame preparation are separate operations.
Is the graph a real Sun or Moon timetable?
No. It holds declination and latitude fixed and samples hour angle. A dated timetable also needs the observation epoch, sidereal time and changing celestial coordinates.