Associated Topics || Dr. Math Home || Search Dr. Math

### Finding Points on the Earth

```
Date: 06/08/2001 at 12:06:26
From: Ryan McGarty
Subject: Impossible Equation?

Hi,

I'm using an equation to determine the distance between two points on
the surface of the earth, and want to get the reverse of this: i.e.
Find the point who has latitude and longitude five miles north of the
given point, and the other three points to the south, east, and west.

Given d = distance, lat1 = latitude 1, lat2 = latitude 2,
lon1 = longitude 1, and lon2 = longitude 2.

d=sin^2( (lat2-lat1)/2 ) + cos(lat1)*cos(lat2)*sin^2( (lon2-lon1)/2 )

How would you solve this for lat2 so you could determine the points
to the left and right of a given surface point?

We already have the solved equation for lon2, so this is the only
remaining problem.

```

```
Date: 06/08/2001 at 12:45:43
From: Doctor Rick
Subject: Re: Impossible Equation?

Hi, Ryan.

I often direct people who inquire about formulas involving latitude
and longitude to the following site:

Aviation Formulary V1.30 - Ed Williams
http://www.best.com/~williams/avform.htm

There you will find a formula for "Lat/lon given radial and distance,"
which is what you seek. Actually, it's more general: given a starting
point, ANY initial heading, and a distance, it calculates the latitude
and longitude of your destination. I quote:

"A point {lat,lon} is a distance d out on the tc radial from point 1
if:

lat=asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
IF (cos(lat)=0)
lon=lon1      // endpoint a pole
ELSE
lon=mod(lon1-asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)-pi
ENDIF

"This algorithm is limited to distances such that dlon <pi/2, i.e
those that extend around less than one quarter of the circumference of
the earth in longitude. A completely general, but more complicated
algorithm is necessary if greater distances are allowed:

lat =asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc))
dlon=atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(lat))
lon=mod( lon1-dlon +pi,2*pi )-pi

End of quote. Here, "distance d" is a "distance" in radians (an arc,
or central angle). You will need to divide your distance (5 miles) by
the radius of the earth (3956 miles) to get the arc in radians.

You are interested in particular values of the "radial" tc, namely 0,
pi/2, pi, and 3*pi/2 radians (N, E, S, W). The first equation (lat) in
the general formula above reduces to these four cases:

N (tc=0): lat = asin(sin(lat1)*cos(d)+cos(lat1)*sin(d))
= asin(sin(lat1 + d)
= lat1 + d

S (tc=pi): lat = asin(sin(lat1)*cos(d)-cos(lat1)*sin(d))
= asin(sin(lat1 - d)
= lat1 - d

E, W (tc=pi/2 or 3*pi/2): lat = asin(sin(lat1)*cos(d))

In the case of N and S, the longitude is just lon = lon1 (the same
longitude as the starting point), because north-south lines follow
lines of longitude. In the case of E and W, use the equations for dlon
and lon to complete the calculation.

NOTE: The introduction to the Aviation Formulary page linked above
says this:

"For the convenience of North Americans I will take North latitudes
and West longitudes as positive and South and East negative. The
longitude is the opposite of the usual mathematical convention."

If you use the convention that east longitudes are positive, you must
make the following sign changes. In the first method,

lon = mod(lon1+asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)-pi

In the second method,

lon = mod(lon1+dlon+pi,2*pi)-pi

- Doctor Rick, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
College Higher-Dimensional Geometry
High School Higher-Dimensional Geometry

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search