Trait GeodesicDistance

Source
pub trait GeodesicDistance<T, Rhs = Self> {
    // Required method
    fn geodesic_distance(&self, rhs: &Rhs) -> T;
}
👎Deprecated since 0.29.0: Please use the Geodesic.distance method from the Distance trait instead
Expand description

Determine the distance between two geometries on an ellipsoidal model of the earth.

This uses the geodesic measurement methods given by Karney (2013). As opposed to older methods like Vincenty, this method is accurate to a few nanometers and always converges.

Required Methods§

Source

fn geodesic_distance(&self, rhs: &Rhs) -> T

👎Deprecated since 0.29.0: Please use the Geodesic.distance method from the Distance trait instead

Determine the distance between two geometries on an ellipsoidal model of the earth.

This uses the geodesic measurement methods given by Karney (2013). As opposed to older methods like Vincenty, this method is accurate to a few nanometers and always converges.

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

// New York City
let p1 = point!(x: -74.006, y: 40.7128);

// London
let p2 = point!(x: -0.1278, y: 51.5074);

let distance = p1.geodesic_distance(&p2);

assert_eq!(
    5_585_234., // meters
    distance.round()
);

Implementors§