Comments on: Lat and Long
http://ask.metafilter.com/14843/Lat-and-Long/
Comments on Ask MetaFilter post Lat and LongSun, 06 Feb 2005 21:02:32 -0800Sun, 06 Feb 2005 21:02:32 -0800en-ushttp://blogs.law.harvard.edu/tech/rss60Question: Lat and Long
http://ask.metafilter.com/14843/Lat-and-Long
Given the latitude and longitude of three points, how can I find the coordinates of the point that is equidistant from them? [mi] <br /><br /> 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 <a href="http://home.att.net/~srschmitt/circle3pts.html">determinant equation</a> is way beyond me. Is there an online calculator or Excel spreadsheet out there that will solve the centre for me?post:ask.metafilter.com,2005:site.14843Sun, 06 Feb 2005 20:57:52 -0800obiwanwasabitriangulationgeometrymathematicstriangleequidistanceBy: obiwanwasabi
http://ask.metafilter.com/14843/Lat-and-Long#255388
Blurk - make that three decimal places of a minute (eg 65o 35.222 N). WGS84, if that matters.comment:ask.metafilter.com,2005:site.14843-255388Sun, 06 Feb 2005 21:02:32 -0800obiwanwasabiBy: grimmelm
http://ask.metafilter.com/14843/Lat-and-Long#255394
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 (<a href="http://jan.ucc.nau.edu/~cvm/latlongdist.html">here</a>''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.<br>
<br>
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.comment:ask.metafilter.com,2005:site.14843-255394Sun, 06 Feb 2005 21:13:41 -0800grimmelmBy: vacapinta
http://ask.metafilter.com/14843/Lat-and-Long#255399
Wow. I was not only going to come in and say what grimmelm just said but also had the same URL ready.<br>
<br>
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.<br>
<br>
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.comment:ask.metafilter.com,2005:site.14843-255399Sun, 06 Feb 2005 21:26:09 -0800vacapintaBy: onalark
http://ask.metafilter.com/14843/Lat-and-Long#255403
Sounds like fun. I'd read <a href="http://mathworld.wolfram.com/Circumcircle.html">Wolfram's</a> definition of the Circumcircle (which is a little better-written than the reference you pointed out).<br>
<br>
Then I'd use <a href="http://www.bluebit.gr/matrix-calculator/">this </a>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!<br>
<br>
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.comment:ask.metafilter.com,2005:site.14843-255403Sun, 06 Feb 2005 21:32:02 -0800onalarkBy: maschnitz
http://ask.metafilter.com/14843/Lat-and-Long#255406
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.<br>
<br>
Look at MathWorld, it has the spherical coordinate equations for the oblong Earth.comment:ask.metafilter.com,2005:site.14843-255406Sun, 06 Feb 2005 21:37:48 -0800maschnitzBy: abcde
http://ask.metafilter.com/14843/Lat-and-Long#255411
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.comment:ask.metafilter.com,2005:site.14843-255411Sun, 06 Feb 2005 21:43:07 -0800abcdeBy: maschnitz
http://ask.metafilter.com/14843/Lat-and-Long#255416
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.<br>
<br>
Good idea, though!comment:ask.metafilter.com,2005:site.14843-255416Sun, 06 Feb 2005 21:51:46 -0800maschnitzBy: AlexReynolds
http://ask.metafilter.com/14843/Lat-and-Long#255417
<i>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.</i><br>
<br>
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.comment:ask.metafilter.com,2005:site.14843-255417Sun, 06 Feb 2005 21:55:38 -0800AlexReynoldsBy: NortonDC
http://ask.metafilter.com/14843/Lat-and-Long#255422
Pedantic: You realize there are two points that are equidistant, right? One being on the other side.comment:ask.metafilter.com,2005:site.14843-255422Sun, 06 Feb 2005 22:09:34 -0800NortonDCBy: ikkyu2
http://ask.metafilter.com/14843/Lat-and-Long#255423
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.)<br>
<br>
Why not just post the 3 co-ordinates so one of us mathy folks can work it out?comment:ask.metafilter.com,2005:site.14843-255423Sun, 06 Feb 2005 22:11:59 -0800ikkyu2By: vacapinta
http://ask.metafilter.com/14843/Lat-and-Long#255428
<i>If you know one, the other is collinear with it and the sphere's center (i.e. antipodean to the first.)</i><br>
<br>
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.comment:ask.metafilter.com,2005:site.14843-255428Sun, 06 Feb 2005 22:17:46 -0800vacapintaBy: onalark
http://ask.metafilter.com/14843/Lat-and-Long#255430
<i>Why not just post the 3 co-ordinates so one of us mathy folks can work it out?</i><br>
<br>
It is almost certainly a homework question. I'm glad he's phrasing it this way, I don't feel guilty about helping out.comment:ask.metafilter.com,2005:site.14843-255430Sun, 06 Feb 2005 22:18:52 -0800onalarkBy: vacapinta
http://ask.metafilter.com/14843/Lat-and-Long#255432
<i>The set of all points that are equidistant will be a line perpendicular to the planar triangle</i><br>
<br>
Never mind. After introducing radial distance in the first place, my brain went back on hold...comment:ask.metafilter.com,2005:site.14843-255432Sun, 06 Feb 2005 22:23:30 -0800vacapintaBy: ROU_Xenophobe
http://ask.metafilter.com/14843/Lat-and-Long#255434
<i>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.</i><br>
<br>
2-D not 3-D, but doesn't the analogous perpendicular bisector of any chord pass through the center of the circle?comment:ask.metafilter.com,2005:site.14843-255434Sun, 06 Feb 2005 22:28:32 -0800ROU_XenophobeBy: obiwanwasabi
http://ask.metafilter.com/14843/Lat-and-Long#255506
Sorry - not a homework question. It's actually to find a <a href="http://geocaching.com">geocache</a>. 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. <br>
<br>
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.<br>
<br>
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!<br>
<br>
If you mathy folk would like to work it out, the coordinates of the three caches on the circumference are:<br>
<br>
35o 17.916 S 149o 09.925 E<br>
35o 16.058 S 149o 09.629 E<br>
35o 16.918 S 149o 05.849 E<br>
<br>
My guess for the centre (before trying to fudge / remeasure the distance to the other caches) is: <br>
<br>
35o 17.371 S 149o 07.904 E<br>
<br>
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.comment:ask.metafilter.com,2005:site.14843-255506Mon, 07 Feb 2005 02:05:20 -0800obiwanwasabiBy: obiwanwasabi
http://ask.metafilter.com/14843/Lat-and-Long#255507
I'd love to know what <em>the </em>math looks like, even.comment:ask.metafilter.com,2005:site.14843-255507Mon, 07 Feb 2005 02:07:09 -0800obiwanwasabiBy: onalark
http://ask.metafilter.com/14843/Lat-and-Long#255515
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.<br>
<br>
I used the methods I described above with:<br>
<br>
x1 = 17.916 y1 = 9.925<br>
x2 = 16.058 y2 = 9.629<br>
x3 = 16.918 y3 = 5.849<br>
<br>
a=<br>
| x1 y1 1 |<br>
| x2 y2 1 |<br>
| x3 y3 1 |<br>
<br>
bx=<br>
| (x1^2 + y1^2) y1 1 |<br>
| (x1^2 + y1^2) y1 1 |<br>
| (x1^2 + y1^2) y1 1 |<br>
<br>
by=<br>
| (x1^2 + y1^2) y1 1 |<br>
| (x1^2 + y1^2) y1 1 |<br>
| (x1^2 + y1^2) y1 1 |<br>
<br>
with your numbers:<br>
a=<br>
| 17.916 9.925 1 |<br>
| 16.058 9.629 1 |<br>
| 16.918 5.849 1 |<br>
bx=<br>
| 419.488 9.925 1 |<br>
| 350.577 9.629 1 |<br>
| 320.430 5.849 1 |<br>
by=<br>
| 419.488 17.916 1 |<br>
| 350.577 16.058 1 |<br>
| 320.430 16.918 1 |<br>
<br>
The determinants are<br>
a = 7.2778<br>
bx = 251.562<br>
by = 115.278<br>
<br>
The solutions are<br>
x0 = bx/2a = 17.283<br>
y0 = by/2a = 7.918comment:ask.metafilter.com,2005:site.14843-255515Mon, 07 Feb 2005 03:02:23 -0800onalarkBy: onalark
http://ask.metafilter.com/14843/Lat-and-Long#255519
And yes, obviously I know nothing about cartography because I got my units all mixed up, but the math is still correct.comment:ask.metafilter.com,2005:site.14843-255519Mon, 07 Feb 2005 03:12:51 -0800onalarkBy: onalark
http://ask.metafilter.com/14843/Lat-and-Long#255524
*sheepish grin* I checked my numbers, and they appear to be only slightly better than yours. <br>
<br>
Using the earlier link to the calculator<br>
<br>
my point:<br>
Distance between 35 17.916'S 149 09.925'E and 35 17.283'S 149 07.918'E is<br>
3.2582 km<br>
<br>
Distance between 35 16.058'S 149 09.629'E and 35 17.283'S 149 07.918'E is<br>
3.4469 km<br>
<br>
Distance between 35 16.918'S 149 05.849'E and 35 17.283'S 149 07.918'E is<br>
3.2057 km<br>
<br>
Using your point:<br>
<br>
Distance between 35 17.916'S 149 09.925'E and 35 17.371'S 149 07.904'E is<br>
3.2231 km<br>
<br>
Distance between 35 16.058'S 149 09.629'E and 35 17.371'S 149 07.904'E is<br>
3.5721 km<br>
<br>
Distance between 35 16.918'S 149 05.849'E and 35 17.371'S 149 07.904'E is<br>
3.2236 km<br>
<br>
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?comment:ask.metafilter.com,2005:site.14843-255524Mon, 07 Feb 2005 03:29:25 -0800onalarkBy: andrew cooke
http://ask.metafilter.com/14843/Lat-and-Long#255541
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.<br>
<br>
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.<br>
<br>
so if the points are p1, p2, p3 then the normals to two possible planes are:<br>
n1 = (p1+p2)^(p1^p2)<br>
n2 = (p1+p3)^(p1^p3)<br>
and the point you want is n1^n2 (or rather, where that intersects with the earth's surface).<br>
<br>
am i talking rubbish? (if not, dr diamond (sic!), my old crystallography prof, would be proud of me ;o)comment:ask.metafilter.com,2005:site.14843-255541Mon, 07 Feb 2005 05:10:44 -0800andrew cookeBy: andrew cooke
http://ask.metafilter.com/14843/Lat-and-Long#255548
a few qualifiers:<br>
- i need to add "and perpendicular to the line joining the points" to define the planes correctly<br>
- you could argue that calculating a vector ("cross") product is "calculating a determinant", kind of.comment:ask.metafilter.com,2005:site.14843-255548Mon, 07 Feb 2005 05:40:21 -0800andrew cooke