Home › Forums › Hiding and Hunting › Puzzle Caches › Determining distance between two coordinates
This topic contains 9 replies, has 6 voices, and was last updated by
Team Black-Cat 15 years, 11 months ago.
-
AuthorPosts
-
12/10/2009 at 12:36 am #1729241
How do I determine the distance between two sets of coordinates by using math, not a GPS? Doing this will help me on the way to solve a puzzle. Thanks 🙂
12/10/2009 at 2:28 am #1917980You can use the program FizzyCalc (free) to do this for you. once you have the program I believe what you are looking for is under the distance tab.
12/10/2009 at 3:17 pm #1917981If you are working on the puzzle that I think you are working on, pay close attention to the description and hints. Some people’s view of the world is skewed, similar to that of people in the 12th century. I wonder if they were worried about sailing off the edge of the world!
12/10/2009 at 5:59 pm #1917982Unless you REALLY need to do the math, you should probably find an online utility to get the distance.
But since you asked…
I recently created a function for a program I’m working on. Here’s what I did.
Keep in mind that I am a programmer and not a mathmatician…Start with decimal degrees instead of degrees and minutes. You can do the conversion on GC.com.
Convert each coordinate to radians:
A=(Point1Latitude * Pi /180)
B=(Point1Longitude * Pi /180)
C=(Point2Latitude * Pi /180)
D=(Point2Latitude * Pi /180)Get the difference between the angles:
DLat=C-A
DLon=D-BNow it gets fun…
X = Sin(DLat / 2) * Sin(DLat / 2) + Cos(A) * Cos(C) * Sin(DLon / 2) * Sin(DLon / 2)
Y = 2 * Atan2(Sqrt(X), Sqrt(1 - X))To get miles, multiply Y by 3959.
Did I get it right Mathman?
Edited to add:
Atan2 might not be on your calculator. It is the angle whose tanget is the quotent of the two specified numbers.12/10/2009 at 7:51 pm #1917983@Team Black-Cat wrote:
A=(Point1Latitude * Pi /180)
B=(Point1Longitude * Pi /180)
C=(Point2Latitude * Pi /180)
D=(Point2Latitude * Pi /180)I assume you meant Point2Longitude for D.
12/10/2009 at 10:19 pm #1917984Yes I did, and thanks for catching that. I can’t edit the original post anymore…
12/11/2009 at 5:44 pm #191798512/12/2009 at 12:05 am #191798612/12/2009 at 4:43 am #1917987For a whole bunch of different versions of this, do a “Google” search using the following words:
gps distance calculator12/12/2009 at 6:04 am #1917988@codejunkie wrote:
For a whole bunch of different versions of this, do a “Google” search using the following words:
gps distance calculatorIf you’re having trouble sleeping, search for “haversine”.
-
AuthorPosts
You must be logged in to reply to this topic.