# Lat and Long

February 6, 2005 8:57 PM Subscribe

Given the latitude and longitude of three points, how can I find the coordinates of the point that is equidistant from them? [mi]

The coordinates for the three points are accurate to three decimal places of a second, and I'd like the same accuracy for the equidistant point. I can plot them on a map then find the intersection of the perpendicular bisections of the chords, but accuracy using this method is dependent on the resolution of the map and my skill with a protractor and ruler. Solving a determinant equation is way beyond me. Is there an online calculator or Excel spreadsheet out there that will solve the centre for me?

The coordinates for the three points are accurate to three decimal places of a second, and I'd like the same accuracy for the equidistant point. I can plot them on a map then find the intersection of the perpendicular bisections of the chords, but accuracy using this method is dependent on the resolution of the map and my skill with a protractor and ruler. Solving a determinant equation is way beyond me. Is there an online calculator or Excel spreadsheet out there that will solve the centre for me?

If you only have to do this once, a simple ad hoc solution is to use progressively better estimates. Eyeball a first guess. Then punch it into a calculator that provides distances between two points on the Earth's surface (here''s the first one I turned up with Gizoogle, er Google). Which of the three points was it furthest from? Nudge your estimate towards that one a bit. Repeat, using smaller nudges as the difference in distances shrinks, until the distances are equal to your desired precision.

This method works for all sorts of similar problems and requires basically no algebra, just the ability to look at numbers and see whcih is bigger and by about how much.

posted by grimmelm at 9:13 PM on February 6, 2005

This method works for all sorts of similar problems and requires basically no algebra, just the ability to look at numbers and see whcih is bigger and by about how much.

posted by grimmelm at 9:13 PM on February 6, 2005

Wow. I was not only going to come in and say what grimmelm just said but also had the same URL ready.

The analytical solution involves converting to spherical coordinates then trying to get the distance in radians then converting back to lat/lon. A simple, circle of three 3-d points wont work since you dont want some point in the center of the earth, you want something on the surface, I think.

Instead of eyeballing though, you could whip up a quick program that uses the lat/lon distance formula and quickly iterates to the right solution with as many decimal places as you want.

posted by vacapinta at 9:26 PM on February 6, 2005

The analytical solution involves converting to spherical coordinates then trying to get the distance in radians then converting back to lat/lon. A simple, circle of three 3-d points wont work since you dont want some point in the center of the earth, you want something on the surface, I think.

Instead of eyeballing though, you could whip up a quick program that uses the lat/lon distance formula and quickly iterates to the right solution with as many decimal places as you want.

posted by vacapinta at 9:26 PM on February 6, 2005

Sounds like fun. I'd read Wolfram's definition of the Circumcircle (which is a little better-written than the reference you pointed out).

Then I'd use this online matrix calculator to solve your determinants for the system. You're going to need to solve three different determinants, a, bx and by, all defined in the Wolfram article (it tells you what values to put in for the three matrices, hopefully the notation isn't too confusing). A subindex on the right indicates whether he is referring to point 1, 2, or 3. A super-2 on the right calls for squaring the value before putting it into the matrix. Thus Remember that by is going to be negative of the correct answer. The final thing to do is to solve for x and y with bx/2a and by/2a. Let me know if you need any help figuring out how to generate the determinants!

On Preview: Whoah, didn't take into account Earth's curvature at ALL. Aye Carumba! I'll leave this on in case you're looking at three relatively close points, in which case you will probably be able to ignore the curvature for the accuracy you're looking for.

posted by onalark at 9:32 PM on February 6, 2005

Then I'd use this online matrix calculator to solve your determinants for the system. You're going to need to solve three different determinants, a, bx and by, all defined in the Wolfram article (it tells you what values to put in for the three matrices, hopefully the notation isn't too confusing). A subindex on the right indicates whether he is referring to point 1, 2, or 3. A super-2 on the right calls for squaring the value before putting it into the matrix. Thus Remember that by is going to be negative of the correct answer. The final thing to do is to solve for x and y with bx/2a and by/2a. Let me know if you need any help figuring out how to generate the determinants!

On Preview: Whoah, didn't take into account Earth's curvature at ALL. Aye Carumba! I'll leave this on in case you're looking at three relatively close points, in which case you will probably be able to ignore the curvature for the accuracy you're looking for.

posted by onalark at 9:32 PM on February 6, 2005

If you really want that level of accuracy, you'll probably have to treat the Earth as an oblong spheroid, instead of the sphere. The Earth is a bit fat around the Equator because of the spinning.

Look at MathWorld, it has the spherical coordinate equations for the oblong Earth.

posted by maschnitz at 9:37 PM on February 6, 2005

Look at MathWorld, it has the spherical coordinate equations for the oblong Earth.

posted by maschnitz at 9:37 PM on February 6, 2005

I'm probably wrong here, but to me it seems that finding the distance by standard triangulation in 3D space then moving the resulting point somewhere inside the Earth out to the surface (however you do that) would work.

posted by abcde at 9:43 PM on February 6, 2005

posted by abcde at 9:43 PM on February 6, 2005

Not quite, abcde. That would only work if it were an equilateral triangle. Otherwise there's an angle between the line formed by centroid of the planar triangle and the centroid of the surface "triangle", and the ray between the Earth's center and the desired point.

Good idea, though!

posted by maschnitz at 9:51 PM on February 6, 2005

Good idea, though!

posted by maschnitz at 9:51 PM on February 6, 2005

*On Preview: Whoah, didn't take into account Earth's curvature at ALL. Aye Carumba! I'll leave this on in case you're looking at three relatively close points, in which case you will probably be able to ignore the curvature for the accuracy you're looking for.*

If your projection is "flat" enough for all three points involved, there won't be as much error. You'd choose the projection that meets this criteria depending on your three points.

posted by AlexReynolds at 9:55 PM on February 6, 2005

Pedantic: You realize there are two points that are equidistant, right? One being on the other side.

posted by NortonDC at 10:09 PM on February 6, 2005

posted by NortonDC at 10:09 PM on February 6, 2005

Also, since we love to pick nits, there are two such equidistant points on the surface of any sphere, although one will be further away from all three points than the other. If you know one, the other is collinear with it and the sphere's center (i.e. antipodean to the first.)

Why not just post the 3 co-ordinates so one of us mathy folks can work it out?

posted by ikkyu2 at 10:11 PM on February 6, 2005

Why not just post the 3 co-ordinates so one of us mathy folks can work it out?

posted by ikkyu2 at 10:11 PM on February 6, 2005

*If you know one, the other is collinear with it and the sphere's center (i.e. antipodean to the first.)*

Is that true? how so? The set of all points that are equidistant will be a line perpendicular to the planar triangle. I dont see how that line is guaranteed to go through the center of the earth.

posted by vacapinta at 10:17 PM on February 6, 2005

*Why not just post the 3 co-ordinates so one of us mathy folks can work it out?*

It is almost certainly a homework question. I'm glad he's phrasing it this way, I don't feel guilty about helping out.

posted by onalark at 10:18 PM on February 6, 2005

*The set of all points that are equidistant will be a line perpendicular to the planar triangle*

Never mind. After introducing radial distance in the first place, my brain went back on hold...

posted by vacapinta at 10:23 PM on February 6, 2005

*s that true? how so? The set of all points that are equidistant will be a line perpendicular to the planar triangle. I dont see how that line is guaranteed to go through the center of the earth.*

2-D not 3-D, but doesn't the analogous perpendicular bisector of any chord pass through the center of the circle?

posted by ROU_Xenophobe at 10:28 PM on February 6, 2005

Response by poster: Sorry - not a homework question. It's actually to find a geocache. It's positioned at the centre of a circle the circumference of which passes through the positions of three other caches. The three caches aren't very far apart at all (the furthest two are 6.5km apart), and we're a fair way from the equator, so I don't think the curvature of the earth is a big problem.

I can position the three caches on a map with software. However, bisecting chords on a printout with a pen and ruler only gets me in the ballpark - a pixel on the map is 12 metres, so allowing for a few pixels each way I'm searching an area of maybe 1200m^2.

I was just going to get in the general area, then sniff around for a likely hiding spot. I really like the idea of fudging my approximate LZ left a little, up a little and so on til I get equal distances from the three caches, or near enough to it. I was just wondering if there was an easy way to crunch the numbers and get a precise location. It seems there is, but I don't remember enough senior math to pull it off!

If you mathy folk would like to work it out, the coordinates of the three caches on the circumference are:

35o 17.916 S 149o 09.925 E

35o 16.058 S 149o 09.629 E

35o 16.918 S 149o 05.849 E

My guess for the centre (before trying to fudge / remeasure the distance to the other caches) is:

35o 17.371 S 149o 07.904 E

I'd love to know what math looks like - maybe if I work through the example I can learn to do it myself. I won't check back til I've found the cache using my own feeble mental resources, though.

posted by obiwanwasabi at 2:05 AM on February 7, 2005

I can position the three caches on a map with software. However, bisecting chords on a printout with a pen and ruler only gets me in the ballpark - a pixel on the map is 12 metres, so allowing for a few pixels each way I'm searching an area of maybe 1200m^2.

I was just going to get in the general area, then sniff around for a likely hiding spot. I really like the idea of fudging my approximate LZ left a little, up a little and so on til I get equal distances from the three caches, or near enough to it. I was just wondering if there was an easy way to crunch the numbers and get a precise location. It seems there is, but I don't remember enough senior math to pull it off!

If you mathy folk would like to work it out, the coordinates of the three caches on the circumference are:

35o 17.916 S 149o 09.925 E

35o 16.058 S 149o 09.629 E

35o 16.918 S 149o 05.849 E

My guess for the centre (before trying to fudge / remeasure the distance to the other caches) is:

35o 17.371 S 149o 07.904 E

I'd love to know what math looks like - maybe if I work through the example I can learn to do it myself. I won't check back til I've found the cache using my own feeble mental resources, though.

posted by obiwanwasabi at 2:05 AM on February 7, 2005

Response by poster: I'd love to know what

posted by obiwanwasabi at 2:07 AM on February 7, 2005

*the*math looks like, even.posted by obiwanwasabi at 2:07 AM on February 7, 2005

I've got a final answer of 17.283 degrees S and 07.918 degrees E. It would be a good idea to use this as your starting approximation and check to see how well it centers your points, then iterate if it isn't close enough. Also, I don't know how accurate your 3 boundary point measurements are, but if they are accurate to more decimal places (i.e. 17.916000), I would trust: 17.2829 and 7.9184.

I used the methods I described above with:

x1 = 17.916 y1 = 9.925

x2 = 16.058 y2 = 9.629

x3 = 16.918 y3 = 5.849

a=

| x1 y1 1 |

| x2 y2 1 |

| x3 y3 1 |

bx=

| (x1^2 + y1^2) y1 1 |

| (x1^2 + y1^2) y1 1 |

| (x1^2 + y1^2) y1 1 |

by=

| (x1^2 + y1^2) y1 1 |

| (x1^2 + y1^2) y1 1 |

| (x1^2 + y1^2) y1 1 |

with your numbers:

a=

| 17.916 9.925 1 |

| 16.058 9.629 1 |

| 16.918 5.849 1 |

bx=

| 419.488 9.925 1 |

| 350.577 9.629 1 |

| 320.430 5.849 1 |

by=

| 419.488 17.916 1 |

| 350.577 16.058 1 |

| 320.430 16.918 1 |

The determinants are

a = 7.2778

bx = 251.562

by = 115.278

The solutions are

x0 = bx/2a = 17.283

y0 = by/2a = 7.918

posted by onalark at 3:02 AM on February 7, 2005

I used the methods I described above with:

x1 = 17.916 y1 = 9.925

x2 = 16.058 y2 = 9.629

x3 = 16.918 y3 = 5.849

a=

| x1 y1 1 |

| x2 y2 1 |

| x3 y3 1 |

bx=

| (x1^2 + y1^2) y1 1 |

| (x1^2 + y1^2) y1 1 |

| (x1^2 + y1^2) y1 1 |

by=

| (x1^2 + y1^2) y1 1 |

| (x1^2 + y1^2) y1 1 |

| (x1^2 + y1^2) y1 1 |

with your numbers:

a=

| 17.916 9.925 1 |

| 16.058 9.629 1 |

| 16.918 5.849 1 |

bx=

| 419.488 9.925 1 |

| 350.577 9.629 1 |

| 320.430 5.849 1 |

by=

| 419.488 17.916 1 |

| 350.577 16.058 1 |

| 320.430 16.918 1 |

The determinants are

a = 7.2778

bx = 251.562

by = 115.278

The solutions are

x0 = bx/2a = 17.283

y0 = by/2a = 7.918

posted by onalark at 3:02 AM on February 7, 2005

And yes, obviously I know nothing about cartography because I got my units all mixed up, but the math is still correct.

posted by onalark at 3:12 AM on February 7, 2005

posted by onalark at 3:12 AM on February 7, 2005

*sheepish grin* I checked my numbers, and they appear to be only slightly better than yours.

Using the earlier link to the calculator

my point:

Distance between 35 17.916'S 149 09.925'E and 35 17.283'S 149 07.918'E is

3.2582 km

Distance between 35 16.058'S 149 09.629'E and 35 17.283'S 149 07.918'E is

3.4469 km

Distance between 35 16.918'S 149 05.849'E and 35 17.283'S 149 07.918'E is

3.2057 km

Using your point:

Distance between 35 17.916'S 149 09.925'E and 35 17.371'S 149 07.904'E is

3.2231 km

Distance between 35 16.058'S 149 09.629'E and 35 17.371'S 149 07.904'E is

3.5721 km

Distance between 35 16.918'S 149 05.849'E and 35 17.371'S 149 07.904'E is

3.2236 km

It does appear that we've locked the center down to within a grid of a couple hundred meters (several football fields). The variation appears to be mostly on the north/south axis, I might try nudging our guesses a little south. Is this good enough?

posted by onalark at 3:29 AM on February 7, 2005

Using the earlier link to the calculator

my point:

Distance between 35 17.916'S 149 09.925'E and 35 17.283'S 149 07.918'E is

3.2582 km

Distance between 35 16.058'S 149 09.629'E and 35 17.283'S 149 07.918'E is

3.4469 km

Distance between 35 16.918'S 149 05.849'E and 35 17.283'S 149 07.918'E is

3.2057 km

Using your point:

Distance between 35 17.916'S 149 09.925'E and 35 17.371'S 149 07.904'E is

3.2231 km

Distance between 35 16.058'S 149 09.629'E and 35 17.371'S 149 07.904'E is

3.5721 km

Distance between 35 16.918'S 149 05.849'E and 35 17.371'S 149 07.904'E is

3.2236 km

It does appear that we've locked the center down to within a grid of a couple hundred meters (several football fields). The variation appears to be mostly on the north/south axis, I might try nudging our guesses a little south. Is this good enough?

posted by onalark at 3:29 AM on February 7, 2005

is it that hard? you just want the instersection of two planes, each defined by the centre of the earth and the mid point of two of the points. the intersection is the vector product of the normals to the planes and the normals are themselves the vector products of the average and of the two points and their cross product.

i'm not sure why people are talking about determinants (although i haven't followed the link) because you're only worried about direction, not length, and determinants are used just for normalisation.

so if the points are p1, p2, p3 then the normals to two possible planes are:

n1 = (p1+p2)^(p1^p2)

n2 = (p1+p3)^(p1^p3)

and the point you want is n1^n2 (or rather, where that intersects with the earth's surface).

am i talking rubbish? (if not, dr diamond (sic!), my old crystallography prof, would be proud of me ;o)

posted by andrew cooke at 5:10 AM on February 7, 2005

i'm not sure why people are talking about determinants (although i haven't followed the link) because you're only worried about direction, not length, and determinants are used just for normalisation.

so if the points are p1, p2, p3 then the normals to two possible planes are:

n1 = (p1+p2)^(p1^p2)

n2 = (p1+p3)^(p1^p3)

and the point you want is n1^n2 (or rather, where that intersects with the earth's surface).

am i talking rubbish? (if not, dr diamond (sic!), my old crystallography prof, would be proud of me ;o)

posted by andrew cooke at 5:10 AM on February 7, 2005

a few qualifiers:

- i need to add "and perpendicular to the line joining the points" to define the planes correctly

- you could argue that calculating a vector ("cross") product is "calculating a determinant", kind of.

posted by andrew cooke at 5:40 AM on February 7, 2005

- i need to add "and perpendicular to the line joining the points" to define the planes correctly

- you could argue that calculating a vector ("cross") product is "calculating a determinant", kind of.

posted by andrew cooke at 5:40 AM on February 7, 2005

This thread is closed to new comments.

posted by obiwanwasabi at 9:02 PM on February 6, 2005