Sun/Moon Calculator
Az/Alt Tool Reference


Context-Sensitive Help
Az/Alt Tool Layout
Map Markers
Google Maps Controls
Marker Controls, Location Properties, and Az/Alt/Dist Outputs
Markers Location Properties Outputs Elevation Profile Units
Google Elevation Service Usage Limits
Technical Notes
Ellipsoidal vs. Spherical Earth Elevation vs. Geoid Height Elevation Profiles Elevation Data Visibility Criterion
Heights of Man-Made Features


The Sun/Moon Calculator Az/Alt Tool uses Google Maps to calculate the azimuth, altitude, and distance between two locations indicated by markers on the map. If you need to make such a calculation, this tool is faster and easier than most of the other methods described in the Sun/Moon Calculator tutorial. You can get similar results using The Photographer’s Ephemeris, except that with the desktop application, you cannot include the height of a man-made feature in the calculation.

The Az/Alt Tool offers a choice of map styles: terrain, road, or satellite-image; each has advantages for specific situations. It can sometimes be surprisingly difficult to locate natural features from satellite imagery, so a terrain map is often much better for initial positioning. But a terrain map is often short on fine detail, especially in urban areas; moreover, the Google Maps satellite-image view offers greater zooming, so it’s sometimes best for final positioning of a marker.

You must run the Az/Alt Tool from the Sun/Moon Calculator by clicking the Az/Alt Tool button at the bottom of the calculator’s main form. The tool will open with the blue marker (Blue map
marker) positioned at the location selected or specified in the calculator’s Location area.

Context-Sensitive Help

Positioning the cursor over the heading for any column in the information area at the top of the map displays a brief description of what the column contains; with some browsers, the description also is displayed on the status line. Clicking on the label brings up the appropriate section on this page. Tooltips are also shown for the marker icons in the information area.

Az/Alt Tool Layout

The Az/Alt Tool comprises a map with two positionable markers, an information area at the top for inputs and outputs, standard Google Maps pan and zoom controls at the upper left of the map, and standard Google map type selectors at the upper right of the map. The appearance of the tool at startup is shown in Figure 1. [AzAltTool.png]

Figure 1. Az/Alt Tool Layout

Map Markers

The tool has two positionable location markers, and several controls at the top of the map. The blue marker (Blue map marker) corresponds to the “From” location; the red marker (Red map marker) corresponds to the “To” location. The marker icons at the right of the Markers column in the table at the top of the map serve to remind of this correspondence.

The “From” marker is initially positioned at the location specified on the calculator’s main form. Either marker can be clicked and dragged to the desired location; latitude and longitude, and azimuth and distance update continuously during dragging; the altitude, displays Dragging ..., as shown in Figure 2, and updates when dragging is completed, as shown in Figure 3. [AzAltToolDragging.png]

Figure 2. Az/Alt Tool: Dragging Marker [AzAltToolMarkerPositioned.png]

Figure 3. Az/Alt Tool: Marker Positioned

The values for azimuth and distance may change slightly after releasing the mouse button at completion of dragging; the final values are determined assuming an ellipsoidal Earth, but because of performance considerations, the values shown during dragging are calculated assuming a spherical Earth. This is explained in greater detail in Technical Notes. The altitude is determined from elevations obtained from the Google Elevation Service, and the response is not fast enough to provide continuous updating.

Right-clicking either marker exchanges the marker positions; double-clicking either marker centers the map on that marker position. Markers can also be controlled using the marker icons at the right of the Markers column.

If precise positioning is required, the easiest approach is usually to center the marker by double clicking on the marker or clicking on the marker icon in the controls area at the top of the map, and use the Google map controls to zoom to the desired level. If necessary, switch to satellite view to get greater zooming or view a feature that is not shown on the terrain map.

Google Maps Controls

The tool has the standard Google pan and zoom controls at the upper left; the standard map-type selectors are at the upper right. The map center can be repositioned by clicking with the mouse and dragging to the desired position.

Marker Controls, Location Properties, Az/Alt/Dist Outputs


The Fit button adjusts the map zoom to just contain (more or less) the two markers. The Swap button exchanges the positions of the “From” (Blue map marker) and “To” (Red map marker) markers.

The marker icons at the right of the column serve to remind of the locations to which the markers correspond. The marker icons also allow some control of the map:

The map can also be controlled by right-clicking or double-clicking directly on either marker, described under Map Markers, or using the buttons provided in the Markers column.

Location Properties

Latitude, Longitude are the latitude and longitude of the two marker locations; east longitudes are positive. These values are normally obtained automatically from the Google Maps API after positioning a marker, but values can be entered in the text box to set a marker to the corresponding location; if a marker position is changed by dragging or one of the other available methods, the manually entered values are replaced with values corresponding to the new location.

Latitude and longitude are displayed in decimal degrees, but may be input either in decimal or in one of the DMS formats described in the section DMS and HM Input in the Sun/Moon Calculator reference, except that neither the latitude nor longitude may contain spaces. The comma between the latitude and longitude is optional, as is the space following the comma.

Elevation is the terrain elevation for each location; it is normally determined from the marker position. The automatically determined value can be overridden by manually entering a value, but that value will be replaced if the marker is dragged. Elevation should not include the height of a man-made structure.

Height is the height of the observer or man-made feature above the terrain elevation. It must be entered manually, and is not updated when the corresponding marker position is changed. This height is not the same as Height Above Horizon on the Sun/Moon Calculator main form.

If the marker positions in Figure 3 correspond to a photographer at the “From” location using a camera on a tripod at a height of 5 feet and the Transamerica Building (height 853 feet) at the “To” location, these heights can be entered, with the results as shown in Figure 4. [AzAltToolHtsAdded.png]

Figure 4. Az/Alt Tool: Heights Added


Azimuth is the azimuth in decimal degrees, measured from true north, from the “From” marker position to the “To” marker position. To get a back azimuth, click the Swap button or ctrl-click on either marker image (with Opera, alt-click) to exchange the markers.

Altitude is the altitude, in decimal degrees, of the “To” marker position from the “From” marker position. It uses the elevation and height of each position and includes correction for atmospheric refraction and Earth’s curvature. If a marker is dragged, Altitude displays Dragging ..., and updates when dragging is completed. If one location cannot be seen from the other, Altitude displays Not visible. The visibility criterion is crude, assuming sea-level elevation for the terrain between the two locations, so it’s a “best case” condition. When the actual elevations between the two locations are not at sea level (which is most of the time), one location may not be visible from the other even if an altitude is displayed.

Distance is the distance on Earth’s ellipsoid, in miles or kilometers, between the two marker locations. It is independent of direction. The spatial distance between the two locations is slightly greater, but the difference is small—typically less than 0.1%.

The azimuth, altitude, and distance are calculated assuming an ellipsoidal Earth, but because of performance considerations, the azimuth and distance shown while dragging a marker are calculated assuming a spherical Earth, and the altitude is not shown. Because of the different means of calculation, the values for azimuth and distance may change slightly after releasing the mouse button at completion of dragging; the final values are the more accurate. The means of calculation are explained in greater detail in Technical Notes.

Elevation Profile

The Az/Alt Tool can generate an elevation profile—a graphical representation of the terrain between the two marker locations—and a sight line between the locations to indicate whether one location is visible from the other.

Two profile heights are available—200 pixels and 400 pixels; these values affect only the profile height—the accuracy is the same in either case. With either setting, the vertical scale is usually greatly exaggerated.

To create a profile, click the Create button; if a profile for the current marker locations has already been created, this button will appear as Show. To hide the profile, click the Hide button; the button will be disabled if no profile has been created or if the profile has already been hidden. When the profile is displayed, the Show button will be disabled.

Dante’s View in the Black Mountains above Death Valley National Park affords a view of several peaks in the Sierra Nevada, but as Figure 5 illustrates, Mount Whitney—the highest point in the 48 contiguous states of the USA—is not one of them. The portions of the terrain shown with a heavy solid line are visible from the “From” location; the portions shown with a light dashed line are not visible. The visibility indication, of course, does not take into account vegetation or man-made features along the path. Because the terrain elevation is based on a finite number of points, the visibility indication may not exactly agree with the sight line, especially over large distances; for the 90-mile distance here, the data points are over 900 feet apart. [DantesViewWhitneyElevProf1.png]

Figure 5. Elevation Profile: Dante’s View to Mount Whitney

The sight line is slightly curved upward; this is not what actually happens, but it is shown this way because the elevation profile is distorted. At the indicated distance of 90.695 miles, the effect of Earth’s curvature is significant—the apparent elevation of Mount Whitney is decreased by almost 5500 feet. Because the elevation profile is shown with a flat—rather than curved—distance axis, it is necessary to similarly distort the sight line to give an accurate indication of visibility. Generating a profile from Dante’s View to Mount Williamson indicates that the latter is visible; a visit to Dante’s View will confirm that Mount Williamson is visible and Mount Whitney is not.

An elevation profile is not necessarily the last word on visibility, especially in an urban area. If a profile is generated for the locations shown in Figure 4, it can be seen from Figure 6 that there are several high points on the terrain. They are all well below the sight line, but some of them may include tall buildings that could block the view of the Transamerica Building. [StrawberryHillTransamericaElevProf1.png]

Figure 6. Elevation Profile: Strawberry Hill to Transamerica Building

Moving the cursor over the plot area will show dots on both the elevation and sight-line plots for each distance along the profile, as shown in Figure 7. [StrawberryHillTransamericaElevProf2.png]

Figure 7. Elevation Profile: Strawberry Hill to Transamerica Building—Tracking Cursor Position

Clicking at a point along the profile will select that distance, and display a tooltip window with the values for distance, the terrain and sight-line elevations, and the altitude, as shown in Figure 8. To hide the tooltip window, click again at the selected point. [StrawberryHillTransamericaElevProf3.png]

Figure 8. Elevation Profile: Strawberry Hill to Transamerica Building—Distance Selected

The unlabeled value at the top is the distance; the distance and elevations are shown in the appropriate English or metric units. The altitude is from the “From” position, including the height, to a point on the terrain at the selected distance; it is shown in degrees. The altitude of the sight line at any point is that of the “To” location, shown in the information area at the top. If the second location is not visible from the first under “best case” conditions (i.e., sea-level terrain between the two locations), the sight-line elevation is not shown.

To help identify features that may block the view of the Transamerica Building, you can click Show on map to place an orange intermediate marker (Orange map marker) on the map, positioned at the selected distance, as shown in Figure 9. If 45° satellite imagery is available, it may help identify potential obstructions; for a man-made structure, the height can often be found from an online resource. [StrawberryHillTransamericaElevProf4.png]

Figure 9. Elevation Profile: Strawberry Hill to Transamerica Building—Marker Placed on Map

One high point for this profile is on Lone Mountain at about 1.4 miles from the “From” location, as shown in Figure 9. Other high points are in the Anza Vista neighborhood at about 1.8 miles, and on Nob Hill, at about 3.6–3.8 miles. Examination of buildings in those areas will show that no building is as high as the height of the sight line above the terrain, so the Transamerica Building should be visible.

The intermediate marker (Orange map marker) isn’t draggable; to move it to a new location, pass the cursor along the elevation profile and select a new distance. To hide the marker, right-click on it; hovering over the marker displays a tooltip to this effect. If either the “From” (Blue map marker) or “To” (Red map marker) marker is moved, or the latitude or longitude of either location is changed, the intermediate marker is hidden.

There is obviously no substitute for field verification of visibility, preferably with a photograph from the intended camera position; this is especially true from a heavily wooded area such as Strawberry Hill. But an advance field trip may be impractical for a one-time visit to a faraway location.

Sometimes it’s helpful to extend an elevation profile far beyond the feature of interest. For example, many scenes in San Francisco—such as the one depicted in Figure 6have hills in the background to the east. Extending the profile to a distance of about 47 miles shows that the highest point has an altitude of about 0.6°, as shown in Figure 10. This is considerably less than the 1.27° altitude of the Transamerica Building, so the building should be slightly more than a Sun or Moon diameter above the horizon. But this may not be true for other locations; when planning a photograph in any urban area with hills or mountains in the background, and it’s important to have a feature above the horizon, it’s always a good idea to check the background. [StrawberryHillTransamericaElevProf5.png]

Figure 10. Elevation Profile: Strawberry Hill to Transamerica Building—Background Hills

Specified heights apply only at the “From” and “To” locations; if you specify a feature height and then create an elevation profile to check the background, the feature height will be shown at the “To” location, with a sight line that’s not relevant to the visibility of the feature. If you find this distracting, reset the “To” height to zero, as was done for Figure 10.

If a profile is displayed and the units or profile height are changed, or the markers are exchanged, the profile is redrawn; the previous elevation data are re-used, so simply redrawing the profile doesn’t require an additional request from the elevation service. The profile is always shown with the “From” location at the left and the “To” location at the right, regardless of the marker positions. If the “From” location is east of the “To” location and you wish to have the profile direction match that of the markers, click Swap to exchange the markers and redraw the profile. The indicated altitude will, of course, be that looking back from the distant location, and the portions of the terrain shown as visible will be quite different.

If either the “From” or “To” marker is moved, or either of the elevations or heights is manually changed while an elevation profile is displayed, the profile is no longer valid, and the Show button changes to Create; click Create if you need to view an updated profile. If the elevation profile is invalid, clicking Show on map has no effect.

Elevation profiles are based on 512 points between the two locations. In most cases, this is more than adequate; however, for long distances, if the sight line is close to the plotted terrain elevation at any point, the visibility of one location from the other should be verified by field observation if at all feasible.


Use the radio buttons to select the units for height and distance—either English (feet and miles) or Metric (meters and kilometers). If the units are changed, the values in the information area are updated; if an elevation profile is shown, it is redrawn using the new units.

Google Elevation Service Usage Limits

When the map boundaries are known, latitude and longitude for any position on the map can be readily determined. The same is not true for elevation, which must be determined from a separate tabulation that is accessed as a function of latitude and longitude. When elevation data are obtained from a Web service, such as Google Elevation Service, the queries can impose a significant load on the servers that provide the data. Accordingly, most such services impose usage limits.

Elevation data for the Az/Alt Tool are obtained using the free Google Elevation Service API, which imposes fairly low limits. If the limits are exceeded, you may get a message indicating that the elevation request has failed for that reason.

Technical Notes

Ellipsoidal vs. Spherical Earth

Azimuth, altitude, and distance are calculated treating the Earth as ellipsoidal, using the WGS 84 ellipsoid and the algorithm developed by Vincenty (1975) and subsequently refined by the US National Oceanic and Atmospheric Administration’s National Geodetic Survey. The geodesic values for azimuth and distance are found using an iterative, compute-intensive procedure that is too slow to provide real-time updates when dragging a marker, and that, in rare cases, also fails to find a solution. Though slightly less accurate, calculations using a spherical Earth model are fast and deterministic; accordingly, they’re used to determine the azimuth and distance displayed while a marker is dragged. Because of this, the displayed azimuth and distance may change slightly when the mouse button is released after dragging is complete. If the ellipsoidal procedure fails, a warning is given and values determined using the spherical model are used.

The NGS have an online calculator that will perform this calculation, known as the geodetic inverse; a PC (Windows® and MS-DOS®) version of the program and the Fortran program source are available for download.

Elevation vs. Geoid Height

Strictly, “elevation” should be the distance above the reference ellipsoid, but in most cases, the error that results from using elevation above mean sea level is negligible, especially at short distances.

Elevation Profiles

Effect of Curvature and Refraction on Apparent Elevation

Because of Earth’s curvature, distant features appear to be lower than they would appear if Earth were flat. Using Earth’s mean radius of 6371 km (3959 mi), with the correction C in feet and the distance D in miles, the effect of curvature is

C ≈ −0.667 D2 .

Because the density of Earth’s atmosphere varies with elevation, light is refracted as it passes through the atmosphere. The effect is opposite that of curvature, making distant features appear higher than they are. The effect of refraction is about 1/7 that of curvature; with the correction R in feet and the distance D in miles, the effect is

R ≈ 0.095 D2 .
The combined effect of curvature and refraction is
C + R ≈ −0.572 D2 .

At short distances, the effect is minor, but at long distances, the effect is significant. For example, at a distance of a mile, the apparent decrease in elevation is about 7 inches; at 30 miles, it is slightly greater than 500 feet, and at 100 miles, it is over 5700 feet. At a distance of 132 miles over sea-level terrain, a 10,000 foot mountain is barely visible.

A realistic elevation profile would show sea-level elevation as curved downward, and because of atmospheric refraction, would also show the sight line as curved downward, with a radius approximately seven times Earth’s. Most graphing packages, including Google Charts used to show elevation profiles here, plot only straight axes. Because sea-level elevation is plotted as a straight line, the compensation for both curvature and refraction is incorporated into the sight line to preserve the vertical distances between the sight line and the terrain. For short distances, the effect usually isn’t noticeable, but for long distances, the sight line will be concave upward (i.e., dipping in the middle). Though its appearance is distorted, the sight line is nonetheless accurate for determining visibility of one point from another.

Effect on Apparent Altitude

Similarly, curvature and refraction combine to decrease the apparent altitude of the feature. If h is the altitude in degrees, Δy is the elevation difference in feet, the altitude can be calculated to good approximation by

h ≈ tan−1 [Δy/(D × 5280)] − 0.0062D ,

with the distance D again in miles. The first term is simply the relationship that would obtain if the Earth were flat; the second term is equivalent to the correction for elevation above; it can be neglected at short distances.

Elevation Data

Values for elevation vary, even among presumptively reliable sources. In the United States, the most reliable values are usually from monument data sheets provided by United States National Oceanic and Atmospheric Administration’s National Geodetic Survey; however, accessing them can be tedious, and they are available for only a few locations, such as major geographical features—so they aren’t practical for creating elevation profiles.

Digital elevation data are convenient, but they are still a work in progress. Although the values are generally reasonable, they sometimes can differ considerably from actual values. When relying on such data, you should be aware that they may not be exact, and you should be prepared to make slight adjustments to camera positions as a Sun or Moon event approaches.

When the calculator’s elevation values have been manually overridden, elevations of nearby features are adjusted when creating an elevation profile; the correction decreases linearly with distance from the “From” and “To” locations. There is no assurance that this adjustment will improve the accuracy of nearby elevations; it simply ensures smooth transitions from the profile endpoints.

Visibility Criterion

The basic criterion for visibility of one location from another is crude, assuming sea-level elevation for the terrain between the two locations—which is a “best case” condition that seldom is applicable. If the Altitude indicates Not visible, the second location is most likely not visible from the first, but display of an altitude does not necessarily ensure visibility. When in doubt, always verify visibility from field observation if at all possible.

Heights of Man-Made Features

When calculating the altitude of a man-made feature, the height of the feature must be added to the base elevation. Heights and illustrations of many tall buildings and other structures in major cities can be obtained from the Skyscraper Page; heights can also be obtained from Emporis or the Council on Tall Buildings and Urban Habitat’s Skyscraper Center; the CTBUH is internationally recognized as the arbiter of the criteria by which tall building height is determined.


Vincenty, T. 1975. Direct and Inverse Solutions of Geodesics on the Ellipsoid with Application of Nested Equations. Survey Review XXII, 176, April 1975, 88–93. Available for download in PDF from the US NOAA NGS website.

The Sun/Moon Calculator, including the Az/Alt Tool, is copyright Jeff Conrad, and all rights remain with the author. There are no restrictions on personal use; however, any commercial use or posting on a website requires express permission of the author. The Az/Alt Tool is provided only for use in conjunction with the Sun/Moon Calculator on the Large Format website; accordingly, it is not included in the zipped file provided for download. The Sun/Moon Calculator is made available for use as a local application by those who may have a slow Internet connection (or sometimes no connection at all). Because the Az/Alt Tool does not function at all without an Internet connection, there is little point in running it locally.

The Az/Alt Tool is also subject to the Google Maps API Terms of Service, linked at the lower right of the map.

The Az/Alt Tool is provided in the hope that it may be useful, but without any warranty of any kind, express or implied, and you assume all risk of use.