Trait geo::algorithm::geodesic_length::GeodesicLength[][src]

pub trait GeodesicLength<T, RHS = Self> {
    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.

Required methods

fn geodesic_length(&self) -> T[src]

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::<f64>::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()
);
Loading content...

Implementors

Loading content...