Latitude and Longitude Distances Routine
View the source...
This script determines the distance between two points defined by latitude and longitude, in miles, statute miles or kilometers. This is a very intense subject and due to the curvature of the Earth, there are slight variations closer to the poles. Input locations as positive values in decimal degrees. The NS and EW selections change them to negative if needed. All 9 variables must be passed to the function. Sample data is for Palm Springs and Thermal airports; psp and ktrm. You may use other data. This is a fully functional routine.