For 2D or 3D Cartesian coordinate systems, there are simple formulas based on the Pythagorean theorem that allow one to calculate distance between two points. But what if the surface is curved, like that of the Earth? In other words, how do you get the shortest distance between two cities ?
Instead of x and y coordinates, the only inputs needed are the cities’ latitudes and longitudes in radians.
If city A has (latitude, longitude) of (Φ1 , λ1 ) while city B is
(Φ2 , λ2), the distance, c , between them is given by:
where r = radius of the Earth = an average of 6371 km. (The latitudes and longitudes are normally given in degrees but they can be easily converted by multiplying each by (π/180).)
If there is a third city, how do we get the area of a triangle on a spherical surface?
This involves a few steps. (1) First calculate a and b in the same way we got c by using the appropriate latitudes and longitudes. (2) For each of the three arc lengths, a, b and c—they are arcs effectively because they are on a curved surface—get corresponding central angles in radians. How? If you imagine the vertex of an angle, θ, at a center of the earth, that angle is the same fraction of 2π radians as the arc length is of the circumference. Thus for example, θc/(2π) = c/(2πr), which simplifies to θc = c/r.
(3) Use the following formulas to get the triangle’s angles A , B and C.
(4) The sum of the triangle’s angles on a spherical surface exceeds 180 degrees or π radians. And it turns out that the triangle’s area, T, is directly proportional to the excess, E:
E = A + B + C – π
and T = Er2
We can try an example with Miami=A= (25.76o, 80.19o) = (0.4496R, 1.400R) Montreal = B = ( 45.50o,73.57o) = (0.794, 1.284) , and Rome = (41.90o, -12.50o) = (0.731, -0.2182).
The Montreal-Miami distance =
a = Montreal-Rome distance = 6582 km and b = Rome-Miami distance = 8340 km
θa = a/r = 6582 km/6371 km = 1.033;
θb = b/r = 8340 km/6371 km = 1.309;
θc = c/r = 2273 km/6371 km = 0.35677.
similarly B = 2.40 and C = 0.2469.
E = A + B + C – π = 0.14957
area =T = 0.14957( 6371 km)2 = 6 070 884 km2
There are online apps which do all this for you automatically. I checked the above numbers and they agree closely with those of https://app.measuremaponline.com/ as can be seen from this screen capture:
The area is about 14% bigger than if one assumed that the triangle was on a flat surface, in which case Hero’s formula would apply.