How to calculate a distance between point a to b by using Longitude and Latitude

Analytics
Enthusiast

How to calculate a distance between point a to b by using Longitude and Latitude

Hi, i need help to use Teradata SQL function to calcuation a distance from point a to point b which are using Longitude and latitude.

Please helps...

thanks,
3 REPLIES
rgs
Enthusiast

Re: How to calculate a distance between point a to b by using Longitude and Latitude

I’m not sure whether you are asking for the formulas or just how to do it in SQL. Maybe you can provide the formula and how the data is represented and then someone could suggest a method.

My suggestion would be to write a UDF or create a UDT (User Defiend Type) that contains the earth coordinates. Then you can define the user defined methods (UDMs) that operate on that data type.

If you are just looking for the formulas you can google that and get all sorts of hits that might be useful to you.
Enthusiast

Re: How to calculate a distance between point a to b by using Longitude and Latitude

Hi Supprem being,

i need both formular and replicate that into SQL. if you have some source of example, i able to clone that.
thanks,
Senior Apprentice

Re: How to calculate a distance between point a to b by using Longitude and Latitude

First you have to define "distance", because there are several ways to calculate this :-)

For the "great circle distance" (http://en.wikipedia.org/wiki/Great_circle) there's already a UDF at
http://www.teradata.com/DownloadCenter/Topic9248-144-1.aspx

Dieter