Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 31 May 2005 @ 17:28:32 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: Distance based on latitude and longitude
From:   Brian.Jones

Thank you for the incredible information. The summary below is what I will be using. Please review and comment if you can.

Thank you again. Your insight is greatly appreciated. -Brian


1. use Haversine Formula for the greatest accuracy

2. use radians instead of degrees

3. convert degrees to radians by multiplying by PI and dividing by 180

4. use 7,912 miles as the Earth's diameter

5. use (22/7) for PI

6. format distance in miles to 8 decimal places.

7. SQL code of an example:

              35.25927 AS LAT1
             ,-81.2238 AS LON1
             ,35.22143 AS LAT2
             ,-81.1492 AS LON2
                   ATAN (
                         SQRT (
                         /SQRT (
                  ) AS DECIMAL(12,8)) AS MILES

  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020