Trait geo::algorithm::geodesic_length::GeodesicLength
source · pub trait GeodesicLength<T, RHS = Self> {
// Required method
fn geodesic_length(&self) -> T;
}
Expand description
Determine the length of a geometry 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§
sourcefn geodesic_length(&self) -> T
fn geodesic_length(&self) -> T
Determine the length of a geometry 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::LineString;
let linestring = LineString::from(vec![
// New York City
(-74.006, 40.7128),
// London
(-0.1278, 51.5074),
// Osaka
(135.5244559, 34.687455)
]);
let length = linestring.geodesic_length();
assert_eq!(
15_109_158., // meters
length.round()
);