Constant Haversine

Source
pub const Haversine: HaversineMeasure;
Expand description

Haversine measures distance on a sphere using the haversine formula. Distances are considered great circle lengths and given in meters.

See HaversineMeasure for all the trait methods available to Haversine.

§Examples

use geo::{wkt, Haversine, Distance};

let start = wkt!(POINT(23.319941 42.698334)); // Sofia: Longitude, Latitude
let finish = wkt!(POINT(24.742168 42.136097)); // Plovdiv: Longitude, Latitude

// Use `Haversine` for measuring on the Earth's surface.h
assert_relative_eq!(
    132433.09929460194,
    Haversine.distance(start, finish)
);

§References

Moritz, H. (2000). Geodetic Reference System 1980. Journal of Geodesy, 74(1), 128–133. doi:10.1007/s001900050278 “Derived Geometric Constants: R1: mean radius” (p131)