Trait geo::algorithm::vincenty_distance::VincentyDistance [−][src]
pub trait VincentyDistance<T, Rhs = Self> {
fn vincenty_distance(&self, rhs: &Rhs) -> Result<T, FailedToConvergeError>;
}
Expand description
Determine the distance between two geometries using Vincenty’s formulae.
Required methods
fn vincenty_distance(&self, rhs: &Rhs) -> Result<T, FailedToConvergeError>
fn vincenty_distance(&self, rhs: &Rhs) -> Result<T, FailedToConvergeError>
Determine the distance between two geometries using Vincenty’s formulae.
Units
- return value: meters
Examples
use geo::prelude::*;
use geo::point;
// New York City
let p1 = point!(x: -74.006f64, y: 40.7128f64);
// London
let p2 = point!(x: -0.1278f64, y: 51.5074f64);
let distance = p1.vincenty_distance(&p2).unwrap();
assert_eq!(
5_585_234., // meters
distance.round()
);