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

`pub struct Location { /* fields omitted */ }`

Location is a Point with unix timestamp

# 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]

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);```

## Blanket Implementations

### `impl<T> ToOwned for T where    T: Clone, `[src]

#### `type Owned = T`

The resulting type after obtaining ownership.

### `impl<T, U> TryFrom<U> for T where    U: Into<T>, `[src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

### `impl<T, U> TryInto<U> for T where    U: TryFrom<T>, `[src]

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

The type returned in the event of a conversion error.