database function to get distance between 2 latitude/longitude points

  • From: dd yakkali <dd.yakkali@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Wed, 29 Apr 2009 09:37:49 -0400

Has anybody written a database funtion to get this?

I got this code from http://www.movable-type.co.uk/scripts/latlong.html

R = earth's radius (mean radius = 6,371km)
Δlat = lat2- lat1
Δlong = long2- long1
a = sin²(Δlat/2) + cos(lat1).cos(lat2).sin²(Δlong/2)
c = 2.atan2(√a, √(1-a))
d = R.c


I am not a math guy, i am just wondering has any one written any db function
for this.

thanks
Deen

Other related posts: