Spherical distance
Spherical distances are calculated over the sphere instead of in a plane.
First:
Then, distances are calculated over a sphere with radius 6371007.0 m. A sphere with this radius has an area equal to that of the WGS84 ellipsoid.
Figure 1 below shows the spherical distance (L) between two points called 1 and 2.
Fig. 1: Principle of spherical distance. The spherical distance or arc length (L) between two points called 1 and 2, depends on c (angle in radians between 2 points with geographical coordinates) and R (radius of the earth as a sphere).
Suppose there are 2 points on earth with geographical coordinates φ1 λ1 and φ2 λ2.
The cosine of arc c between the 2 points can be found as:
cos c = sin φ1 sin φ2 + cos φ1 cos φ2 cos(λ2 - λ1)
However, because of inaccuracy of the formula above at small distances (cos c values close to 1), the equation above is replaced by the following:
sin(c/2) = Ö{sin2[ (φ2 - φ1) / 2 ] + cos φ1 cos φ2 sin2[ (λ2 - λ1) / 2 ] }
Thus:
c = arcsin Ö{sin2[ (φ2 - φ1) / 2 ] + cos φ1 cos φ2 sin2[ (λ2 - λ1) / 2 ] } * 2
(c expressed in radians)
Then, the arc length (L), i.e. the spherical distance over a great circle arc less than 180 (half the earth's circumference) is found as:
L = c * R
See also:
Spatial correlation : functionality
Cross variogram : functionality
Nearest point : functionality / algorithm
Moving average : functionality