|


Finding the Center of Three Latitude/Longitude PointsDate: 07/27/2005 at 11:56:24 From: Stanley Subject: Determing center point in Lat/Long based on 3 given points Dr. Math, I need help with a latitude/longitude formula. If I have 3 known points (lat/long), how do I get the center point in latitude/longitude coordinates? Location 1: Lat 38.714642 Long -90.256857 Location 2: Lat 41.143586 Long -96.238873 Location 3: Lat 38.942661 Long -90.892235 What would the center point coordinates formula be in Lat/Long format?
Date: 07/28/2005 at 22:01:47
From: Doctor Rick
Subject: Re: Determing center point in Lat/Long based on 3 given points
Hi, Stanley.
That's an interesting problem! I don't have a formula offhand, but I
can see a way to derive one.
The three points lie on a "small circle" on the globe, and you want
the center of this circle. The small circle is the intersection of
the sphere with the plane containing the three points. The center of
the circle is on the line through the center of the sphere and
perpendicular to the plane. This line is perpendicular to any line in
the plane through the point.
Thus, all we need to do is to construct the lines from point 1 to
point 2 and from point 1 to point 3, and then construct the line that
is perpendicular to both of them. Its direction can tell us the
latitude and longitude of the center of the small circle.
This is best done using vector algebra. If the three points are A, B,
and C, we view them as vectors from the center of the sphere to the
three points respectively. The cross-product of vectors B-A and C-A,
(B-A)x(C-A), is the vector we seek.
First we must convert the latitudes and longitudes to 3-dimensional
cartesian coordinates on a sphere of radius 1, using the
transformation
x = cos(lon)*cos(lat)
y = sin(lon)*cos(lat)
z = sin(lat)
Now I'll call the three points in Cartesian space (x1, y1, z1), (x2,
y2, z2), and (x3, y3, z3). The cross-product is
N = (B-A)x(C-A)
= (x2-x1, y2-y1, z2-z1) x (x3-x1, y3-y1, z3-z1)
= ((y2-y1)(z3-z1)-(z2-z1)(y3-y1),
(z2-z1)(x3-x1)-(x2-x1)(z3-z1),
(x2-x1)(y3-y1)-(y2-y1)(x3-x1))
Next we convert N back to latitude and longitude. Its length is not
1, as the vectors A, B, and C were, so we will need to calculate its
length:
r = sqrt(xn^2 + yn^2 + zn^2)
where xn, yn, and zn are the coordinates of N. Finally, the latitude
and longitude of the center are
latc = arcsin(zn/r)
lonc = arctan(yn/xn)
To get it right, we should use the atan2() function provided by many
programming languages to determine which of two possible longitudes
with the same tangent is the correct one. Also, not only the center
of the small circle but its antipode (the opposite point on the earth)
correspond to vectors perpendicular to the plane of the small circle;
both can be viewed as centers of the small circle. To get the correct
one, order the points A, B, and C so that they are counterclockwise
around the center you want.
I know this isn't a simple formula on the order of those for distance
or bearing between two points. It is instead an algorithm with
several steps. But all the necessary parts are here. I hope you can
implement it. Let me know if anything doesn't work; I have not
checked my work carefully, I'll be depending on you for that.
- Doctor Rick, The Math Forum
http://mathforum.org/dr.math/
Date: 08/08/2005 at 17:38:04 From: Stanley Subject: Determing center point in Lat/Long based on 3 given points Doctor Rick, Thank you for responding with such great detail. Your solution is very nice! - Stanley |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]


Ask Dr. MathTM
© 1994-2008 The Math Forum
http://mathforum.org/dr.math/