Struct rsgeo::prelude::Location [−][src]
pub struct Location { /* fields omitted */ }
Location is a Point with unix timestamp
Implementations
impl Location
[src]
pub fn new(pos: Point, timestamp: u64) -> Self
[src]
Example
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
Example
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(
&self,
other: &Trajectory
) -> Option<u64>
[src]
&self,
other: &Trajectory
) -> Option<u64>
return the shortest time distance from trajectory
Example
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); t.push_location(&loc1); t.push_location(&loc2); t.push_location(&loc3); assert_eq!(loc.time_shortest_distance_from_trajectory(&t).unwrap(),100);
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
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnwindSafe for Location
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,