View Source Distance.GreatCircle (Distance v1.1.3)
Calculate great circle distances (shortest travel distance on the surface of a spherical Earth) given a two longitude-latitude pairs. This is an implementation of the Haversine formula and approximates using a spherical (non-ellipsoid) Earth with a mean radius of 6,371,008.8 meters derived from the WGS84 datum.
The function accepts two tuples in the form of {longitude, latitude}
and
returns the distance in meters. It will also accept a List of tuples.
Summary
Functions
Returns the great circle distance in meters along a linestring defined by the
List of {longitude, latitude}
pairs.
Returns the great circle distance in meters between two points in the form of
{longitude, latitude}
.
Types
Functions
Returns the great circle distance in meters along a linestring defined by the
List of {longitude, latitude}
pairs.
Examples
iex> Distance.GreatCircle.distance([
...> {-96.796667, 32.775833},
...> {126.967583, 37.566776},
...> {151.215158, -33.857406},
...> {55.274180, 25.197229},
...> {6.942661, 50.334057},
...> {-97.635926, 30.134442}])
44728827.84910666
Returns the great circle distance in meters between two points in the form of
{longitude, latitude}
.
Examples
iex> Distance.GreatCircle.distance({-105.343, 39.984}, {-105.534, 39.123})
97129.22118968463
iex> Distance.GreatCircle.distance({-74.00597, 40.71427}, {-70.56656, -33.42628})
8251609.780265334