Forum Discussion

Re: Is there a formula within Quickbase that would calculate the miles from one point to another if the latitude and longitude were supplied for two locations?

You got to be kidding me! If you want a flatland approximation this formula would have better results because you can specify the mean latitude (ie phim) and calculate the delta lat/lon between the two points:

Spherical Earth Projected To A Planehttp://en.wikipedia.org/wiki/Geographical_distance#Spherical_Earth_projected_to_a_plane

delta latitude (delta phi) delta longitude (delta lambda) mean latitude (phim)
Try this formula where phim it taken as the mean latitude of the continental United States:
var number OriginLat = [Patient Zip Code - Latitude]; var number OriginLong = [Patient Zip Code - Longitude]; var number DestLat = [Consultant Zip Code - Latitude]; var number DestLong = [Consultant Zip Code - Longitude]; var number cosphim = 0.76791099268; var number radius = 3963.1676;
$radius * (($OriginLat - $DestLat)^2 + ($cosphim * ($OriginLong - $DestLong))^2)^0.5
The GEOGRAPHIC CENTER of the UNITED STATES LAT. 39�50' LONG. -98�35'
39 degrees 50 arcminutes = 0.695222819 radians cosphim = cosine(0.695222819) = 0.76791099268
Radius of Earth in Miles: 3,963.1676
No RepliesBe the first to reply