+ Reply to Thread
Results 1 to 4 of 4

Calculating distance from Lat/Long GPS Coordinates

  1. #1
    Registered User
    Join Date
    06-14-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    5

    Calculating distance from Lat/Long GPS Coordinates

    I have a large dataset of 80,000 + rows with Lat / Long coordinates in Deg/Mins/Secs. It is simple to convert these to decimal degrees. Could anyone assist with the right formula to calculate distance from these coordinates and then to convert the distance into Speed?

    For reference I am trying to calculate speed over ground (SOG) for a ship.

    The data is per second. Is it necessary to calculate distance per second or would it be more accurate to convert the data per second into minutes and then calculate from there ?

    Thanks

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Calculating distance from Lat/Long GPS Coordinates

    This seems mathematically possible, though it's beyond me. Fortunately, there are more diligent people out there who've done the math already, resulting in:

    =ACOS(COS(RADIANS(90-Lat1)) *COS(RADIANS(90-Lat2)) +SIN(RADIANS(90-Lat1)) *SIN(RADIANS(90-Lat2)) *COS(RADIANS(Long1-Long2))) *6371

    This formula is completely cribbed from the site below. I would recommend reading the relevant entry via the link, as it explains which conditions/units are being used and offers a few alternatives.

    http://bluemm.blogspot.com/2007/01/e...-distance.html
    If your problem has been solved, please use "Thread Tools" to mark the thread as "Solved".

    If you're grateful for this site's existence and would like to contribute to the community, please consider posting something hilarious in our joke thread:
    https://www.excelforum.com/the-water...ke-thread.html

  3. #3
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Re: Calculating distance from Lat/Long GPS Coordinates

    I don't know if the above solution works but I'll lay out the process alternatively.

    For this you use the Haversine Formula which is well laid out in wikipedia. (I'd show the formulas but classically they are discussed with Greek letter variables so it's better for you to read it from there to learn it "properly".)

    The only 2 things that you HAVE to get from the page, if you want to skip over the theory (trouble awaits you young Luke with that course, though), are the hav(theta) formula using Sine and Cosine (SIN, COS), and the formula for d(distance) slightly below that. Look for the word "explicitly" for the simplified formula version for d. Beside SIN and COS you'll need to use ASIN and SQRT.

    Note that you will need to first convert degrees to radians (multiply each number of degrees by PI() / 180).

    There is a complexity that some might be tempted to gloss over, which is the component "r" which is the radius of the earth. Unfortunately that varies from place to place on the planet. You'll have to decide how to address that. You can get a ballpark result by using the mean earth radius but then present your results with a margin of error disclosure.

    The wiki article discusses that and other vital caveats. It's a good article to learn from. Otherwise I would suggest learning Haversine from another source, such as the footnote references in wikipedia.

  4. #4
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Re: Calculating distance from Lat/Long GPS Coordinates

    I might caution you not to stumble over terminology as you appear to use the terms "minutes" and "seconds" both as a trigonometric measurement, and as a measure of time, which will be the next step after computing distance. (I'm just saying that I myself might stumble and make temporary missteps from that.)

    As to expressing speed per minute or per second, wouldn't you want to use per hour? If your time measurements are in seconds, divide by 60 for number of minutes, then divided by 60 again for number of hours, and speed is distance divided by time. When you say "convert ... and then calculate from there" I don't follow what you would then calculate, other than the simple division of distance over time.

    As far as which is more accurate, for speed per time second, minute, or hour, each should give equivalent precision to about 15 significant digits.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Calculating the distance between coordinates with conditions
    By chucky11 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-22-2017, 09:07 AM
  2. How to calculate distance between coordinates
    By madelingirly in forum Excel General
    Replies: 4
    Last Post: 10-01-2015, 02:00 PM
  3. [SOLVED] geo-coordinates distance issue
    By dmitrij in forum Excel General
    Replies: 1
    Last Post: 02-20-2014, 09:58 AM
  4. Distance between Coordinates
    By dustinh48625 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-11-2013, 09:17 PM
  5. Replies: 0
    Last Post: 09-19-2012, 09:04 PM
  6. Coordinates and Distance formula
    By cporter5 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2010, 06:41 PM
  7. Distance between two sets of coordinates.
    By Marcus Fox in forum Excel General
    Replies: 2
    Last Post: 03-20-2006, 12:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1