Given the latitude, longitude, and elevation of two points on the Earth,
this calculator determines the azimuth (compass direction) and distance
of the second point (B) as seen from the first point (A).
See also:Latitude/Longitude Calculator.
That page performs the inverse calculation: it figures out the coordinates
of a target point, given the coordinates of an origin point, an azimuth,
and a distance.
If a point is North of the equator, make its latitude positive. If South, it is negative.
If a point is East of the prime meridian (Greenwich, England), its longitude is positive.
For anywhere in the United States, the longitude is a negative number because
we are west of England!
Elevation is how many meters above sea level a point is.
If you don't know the elevation of the points involved,
you can still get a pretty accurate answer
in most cases by leaving it at 0 (zero).
Use a negative value for points beneath sea level.
The distance is defined as the length of the straight line between the points,
ignoring the Earth's curvature.
If the points are far enough apart, chances are this straight line goes right through the Earth.
The azimuth is how many degrees clockwise from North you have to rotate in order
to face Point B when standing at Point A.
The altitude is how many degrees above (if positive) or below (if negative) the horizon
Point B is when seen from Point A.
For example, if A and B are both at sea level, as B gets farther away, it
gradually dips below the horizon because of the Earth's curvature.
This calculator corrects for oblateness of the Earth. As you get closer to the equator,
the distance from the center of the Earth is greater than it is near the poles.
See the Earth radius article
on Wikipedia for more information.
I created this tool to help understand the directionality of the magnetic loop
antenna on my home-made reflex radio.
I used the
FCC online AM radio station database
to find the latitude and longitude of a broadcast tower I am tuned to, and
to confirm that when the magnetic loop antenna faces it, the azimuth is consistent
with what I calculate here.
STEAL MY CODE! If you want to see how this works, or even adapt it for use
on your own web site, just use your browser's "View Source" option to see
If you do copy the code and use it somewhere else, I would appreciate a link
back to this page as credit.