pub trait HaversineLength<T, RHS = Self> {
    // Required method
    fn haversine_length(&self) -> T;
}
Expand description

Determine the length of a geometry using the haversine formula.

Note: this implementation uses a mean earth radius of 6371.088 km, based on the recommendation of the IUGG

Required Methods§

source

fn haversine_length(&self) -> T

Determine the length of a geometry using the haversine formula.

§Units
  • return value: meters
§Examples
use geo::prelude::*;
use geo::LineString;

let linestring = LineString::<f64>::from(vec![
    // New York City
    (-74.006, 40.7128),
    // London
    (-0.1278, 51.5074),
]);

let length = linestring.haversine_length();

assert_eq!(
    5_570_230., // meters
    length.round()
);

Implementors§