Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 27 May 2005 @ 07:54:20 GMT


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


Subj:   Re: Distance based on latitude and longitude
 
From:   Victor Sokovin

  I would like to calculate the distance between 2 physical locations based on their latitude and longitude. Has anyone done this in Teradata? I've seen various forumulas and the Haversine formula looks to be the most accurate, especially on shorter distances.  


Somebody on MathForum has gone into a great extent explaining the formula:

www.mathforum.org/library/drmath/view/51879.html .

TD supports all the functions required, including ATAN2. Converting the formula to TD SQL should not be a big deal.

What might be worth spending time on is the rounding. ATAN is a fast-growing function so a small variation of its argument will lead to a significant difference in the result. If I were to implement the formula in TD, I would make sure to get a reliable reference data set and would keep testing the SQL against it until I like the results.


Regards,

Victor



     
  <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: 15 Jun 2023