Trait geo::algorithm::rhumb::RhumbDistance
source · pub trait RhumbDistance<T, Rhs = Self> {
// Required method
fn rhumb_distance(&self, rhs: &Rhs) -> T;
}
Expand description
Determine the distance between two geometries along a rhumb line.
Note: this implementation uses a mean earth radius of 6371.088 km, based on the recommendation of the IUGG
Required Methods§
sourcefn rhumb_distance(&self, rhs: &Rhs) -> T
fn rhumb_distance(&self, rhs: &Rhs) -> T
Determine the distance between along the rhumb line between two geometries.
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.rhumb_distance(&p2);
assert_eq!(
5_794_129., // meters
distance.round()
);