About the Mileage Calculator
We have a dataset that includes latitudes and longitudes for a variety of cities. First, we approximate the distance between two cities in nautical miles. A nautical mile is an angular measurement equal to one arc-minute along any great circle of the earth.1 We convert nautical miles to statute miles using the international measure of one nautical mile is 1852 meters.
The program computes distance as though the earth were a sphere, which it isn't, but errors should be negligable.
Method of Solution
Latitude and longitude combined with the radius of the sphere provide three-dimensional polar coordniates. The problem yields the same angle for any radius, so a radius of 1 is used. The program converts the polar coordinates to cartesian (x,y,z) coordinates with the following equations:
x = cos(latitude) * cos(longitude) y = sin(latitude) * cos(longitude) z = sin(latitude)
After computing the (x,y,z) coordinates for the two points, the distance between them is calculated as:
c = sqrt((x1-x0)2 + (y1-y0)2 + (z1-zo)2)
The triangle formed by the center of the sphere and the two points contains the angle in question. The sides of the triangle are the distance computed above and two radii (1). The Law of Sines yeilds the following equation for our angle:
a = acos((2-c2)/2)
As nautical miles are arc minutes, the answer is a*60 nautical miles.
If we're missing data for your city, there's not much we can do. Direct other questions or comments here.
If you're a repeat visitor, you may notice that the Google Ads are new. We like Google and thought we'd give it a try.
1 McGraw Hill Dictionary of Scientific and Technical Terms, Second Edition