geo::algorithm::vincenty_length

Trait VincentyLength

Source
pub trait VincentyLength<T, RHS = Self> {
    // Required method
    fn vincenty_length(&self) -> Result<T, FailedToConvergeError>;
}
Expand description

Determine the length of a geometry using Vincenty’s formulae.

Required Methods§

Source

fn vincenty_length(&self) -> Result<T, FailedToConvergeError>

Determine the length of a geometry using Vincenty’s formulae.

§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),
    // Osaka
    (135.5244559, 34.687455)
]);

let length = linestring.vincenty_length().unwrap();

assert_eq!(
    15_109_158., // meters
    length.round()
);

Implementors§