Trait geo::algorithm::centroid::Centroid [] [src]

pub trait Centroid {
    fn centroid(&self) -> Option<Point>;
}

Calculation of the centroid.

Required Methods

fn centroid(&self) -> Option<Point>

Calculation the centroid, see: https://en.wikipedia.org/wiki/Centroid

use geo::{Point, LineString, Coordinate};
use geo::algorithm::centroid::Centroid;

let mut vec = Vec::new();
vec.push(Point::new(40.02f64, 116.34));
vec.push(Point::new(40.02f64, 116.34));
let linestring = LineString(vec);

println!("Centroid {:?}", linestring.centroid());

Implementors