Solar geometry · closed-form
Declination, equation of time, hour angle — the same closed-form spherical-astronomy identities, forward (date/time → sun position) and inverse (sun position → date/time). Standard/solar time throughout unless noted.
Timezone offset for added locations is estimated from longitude (round(lon/15)), not authoritative — this tool otherwise ignores civil timezones/DST entirely and always shows solar or UTC time.
x = day of year · y = UTC hour · solid = sunrise · dashed = sunset.
Same clock time every day of the year, traced across the year.
Azimuth = angle (N = top, clockwise), elevation = radius (center = zenith, ring = horizon).
Every (azimuth, elevation) reachable at any hour of any day of the year, at this latitude — closed form:
sin(δ) = sin(φ)sin(El) + cos(φ)cos(El)cos(Az), reachable exactly when
|sin(φ)sin(El) + cos(φ)cos(El)cos(Az)| ≤ sin(23.45°).
Set an object's height and its shadow's length + direction (click the compass to set the direction the shadow points, or type it) — this fully determines a light azimuth/elevation, which is back-solved into the closest matching day-of-year + time-of-day. Generically two candidate days per year satisfy any given (azimuth, elevation) at a location — one before and one after a solstice — so whichever is nearer the reference day below is picked.
Bearing is the compass direction the shadow points AWAY from the object (i.e. away from the sun) — click the dial to set it visually.
Declination (Cooper's approximation, day-of-year N):
δ = 23.45° · sin(360°/365 · (284 + N))
Equation of time (minutes, Spencer's approximation):
B = 360°/365 · (N − 81) EoT = 9.87·sin(2B) − 7.53·cos(B) − 1.53·sin(B)
Local solar time → hour angle:
t_solar = UTC_hours + λ/15 + EoT/60 (λ = longitude, +East) H = 15° · (t_solar − 12) (H<0 morning, H>0 afternoon)
Elevation and azimuth (φ = latitude, Az from North, clockwise):
El = arcsin( sinφ·sinδ + cosφ·cosδ·cosH ) Az = atan2( sinH, cosH·sinφ − tanδ·cosφ ) + 180° (normalize to 0–360°)
This atan2 form is numerically clean (no quadrant if/else needed) and gives exactly one (El, Az) per (lat, lon, DOY, UTC). Forward is always unique.
The horizontal→equatorial step is closed-form and unique:
δ = arcsin( sinφ·sinEl + cosφ·cosEl·cosAz ) H = atan2( sinAz, cosAz·sinφ − tanEl·cosφ ) + 180° (wrap to −180°..180°)
Then t_solar = 12 + H/15, and UTC = t_solar − λ/15 − EoT/60 (EoT needs a DOY guess — converges in ~1 iteration, its effect is <16 min).
The non-unique part is inverting δ back to N:
N₁ = 365/360 · arcsin(δ/23.45) − 284 (mod 365) N₂ = 365/360 · (180° − arcsin(δ/23.45)) − 284 (mod 365)
So: no, not a single solution. Generically two (DOY, UTC) pairs per year satisfy a given (Az, El) at a given location — one before and one after a solstice, mirror images in declination. Exactly one solution at the solstice itself, zero if the implied |δ| > 23.45° (astronomically impossible at that latitude for those inputs).
Sunrise/sunset hour angle:
H₀(DOY) = arccos( −tanφ·tanδ(DOY) )
(use El = −0.833° instead of 0 for refraction/solar-disk-corrected sunrise/sunset)
sunrise(DOY) = 12 − H₀(DOY)/15 → then convert to UTC via λ, EoT sunset(DOY) = 12 + H₀(DOY)/15 → same
An exact spherical-astronomy identity, dual to the elevation formula:
sin(δ) = sin(φ)·sin(El) + cos(φ)·cos(El)·cos(Az)
A given (Az, El) is reachable on some day of the year exactly when the δ this implies falls within the sun's real annual range:
|sin(φ)·sin(El) + cos(φ)·cos(El)·cos(Az)| ≤ sin(23.45°)
Near El→90°, the cos(El) term vanishes and the equation reduces to sin(φ) ≈ sin(δ), satisfiable only when |φ| ≤ 23.45° — so only tropical latitudes can reach the zenith, with zero special-casing needed. Rendered by scanning elevation densely per azimuth and keeping whatever satisfies the inequality — cheap, and exact in the limit.
Declination: Cooper's approximation. Equation of time: Spencer's Fourier approximation. Sunrise/sunset use El₀ = −0.833° (refraction + solar disk radius).