# How do I adjust the sunrise equation to account for elevation?

I have been working with the sunrise and sunset formula, using the equations from Wikipedia. The problem is that, in my usage thereof, it seems that it only works for sea level; if I start with coordinates that correspond to any point above sea level (or below, for that matter), it will still output the sunrise and sunset for my coordinates at sea level.

For example, today (21/01/2018), in Denver, CO (~1mi above sea level), sunrise was at 07:15:28. Yet my equations keep yielding 07:15:41, which is exactly on-target, were Denver at sea level. How do I account for the fact that higher altitudes experience sunrise earlier than lower altitudes of the same coordinates?

• Assuming you're referring to "For observations on a sea horizon an elevation-of-observer correction" on the wikipedia page, could you show us your calculations in both cases? However, as @JohnHoltz notes below, the elevation dip only applies if you're that far above the surrounding terrain, not above sea level.
– user21
Jan 22, 2018 at 3:05
• @barrycarter I mean that for two observers at the coordinates (0,0), the one at sea level will see the sunrise shortly after the one at 1000 feet and the sunset shortly before. Jan 22, 2018 at 4:29
• I understand. Could you actually show both calculations for Denver and how they yield 07:15:41?
– user21
Jan 22, 2018 at 5:58

Higher elevations by themselves do not change the time of sunrise.

The horizon at sea level is 90 degrees from the zenith. The horizon at Denver is still an angle of 90 deg from the zenith if you assume that the ground is "flat". In other words, even though you are 1 mile high in Denver, you cannot see the horizon at 0 mile elevation.

If you are on a hill or mountain and looking down so that the distant horizon is more than 90 degrees from the zenith, then sunrise would occur early. If you are in a valley and the sun rises behind a hill or mountain, the sun rises later.

So you need to know the elevation of the observer and horizon (or obstacles). From that you can calculate the altitude of the sky in that direction. From that you can calculate the time of rising.

(edit Jan 24) For points that are close to each other, simple trigonometry can be used. $$\tan(\theta)=y/x$$ where y is the difference in elevation between points 1 and 2, and x is the distance. Sunrise occurs when the altitude of the Sun is $\theta-sun's\;radius-refraction$. For more distant points with latitude (lat) and longitude (long), solving for the sides and angles of a triangles gives an approximate solution. (I am sure there are more precise formulas that account for the Earth's shape.) From the figure below, $$a=radius\;of\;Earth+Elevation1$$ $$b=radius\;of\;Earth+Elevation2$$ $$\cos(\gamma)=\sin(lat1)\sin(lat2)+\cos(lat1)\cos(lat2)\cos(long1-long2)$$ $$c=\sqrt{a^2+b^2-2ab\cos(\gamma)}$$ $$\cos(\alpha)=\frac{b^2+c^2-a^2}{2bc}$$ $$\theta=\alpha-90$$ and sunrise occurs when the altitude of the sun is $\theta-sun's\;radius-refraction$. Naturally, you need to check all locations along the line of sight between the observer at point 1 and the obstruction at point 2 to find the highest obstruction. • I knew all of this. My question was how you calculate all of that stuff, given the elevations. Jan 22, 2018 at 3:01
• I am not sure I understand what you want. Let's say you are at sea and the sunrise is at 7:15:41. If you are 5000 feet above the sea in an airplane, the sun will rise earlier because you are high above the local ground. If you are at 5000 feet above sea level because you are in Denver, the sunrise will be at 7:15:41 because you are 0 feet above the local ground. Are you asking for this? If you know latitude, longitude, elevation at point 1 and know that the sun rises behind latitude, longitude, elevation at point 2, how late or early will the sun rise? Jan 22, 2018 at 18:09
• That’s exactly what I mean, yes. Jan 22, 2018 at 18:40
• We know that the Earth rotates >about< 361° (not 360°) per day and the day is 1,440 minutes long, so if you're at a location where the horizon is one degree below the observer, then sunrise/sunset is off by 1/361 * 1440 from calculated sea level. Since for any altitudes you're likely to encounter, the earth may be considered flat, simple trig ought to suffice for figuring out how far below horizontal the horizon is at. Jan 22, 2018 at 20:18