Struct rsgeo::prelude::Location[][src]

pub struct Location { /* fields omitted */ }

Location is a Point with unix timestamp


impl Location[src]

pub fn new(pos: Point, timestamp: u64) -> Self[src]


use rsgeo::prelude::{Point,Location};
let p = Point::new(35.12,46.15).unwrap();
let loc = Location::new(p,123);

pub fn distance(&self, other: &Self) -> f32[src]

calculate distance between location and location

pub fn distance_from_point(&self, other: &Point) -> f32[src]

calculate distance between location and Point

pub fn distance_from_trajectory(&self, other: &Trajectory) -> Option<f32>[src]

calculate distance between location and Trajectory

pub fn speed(&self, other: &Self) -> f32[src]

calculate speed between two locations,return m/s


use rsgeo::prelude::{Point,Location};
let loc1 = Location::new(Point::new(25.12,110.15).unwrap(),100);
let loc2 = Location::new(Point::new(25.119,109.995).unwrap(),3700);
assert!(loc1.speed(&loc2) - 4.3396673 < 1e-6);

pub fn time_shortest_distance_from_trajectory(
    other: &Trajectory
) -> Option<u64>

return the shortest time distance from trajectory


use rsgeo::prelude::*;
let loc = Location::new(Point::new(25.12,110.15).unwrap(),100);
let loc1 = Location::new(Point::new(25.11,120.98).unwrap(),0);
let loc2 = Location::new(Point::new(26.2,121.1).unwrap(),7200);
let loc3 = Location::new(Point::new(26.3,121.3).unwrap(),14400);
let mut t = Trajectory::with_capacity(3);

pub fn degree(&self, other: &Location) -> f32[src]

Trait Implementations

impl Clone for Location[src]

impl Copy for Location[src]

impl Debug for Location[src]

impl Eq for Location[src]

impl PartialEq<Location> for Location[src]

impl StructuralEq for Location[src]

impl StructuralPartialEq for Location[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.