[][src]Struct vadeen_osm::geo::Coordinate

pub struct Coordinate {
    pub lat: i32,
    pub lon: i32,
}

Represents a coordinate containing latitude and longitude.

Coordinates are usually represented by floating point numbers, for coordinates in the osm system we do not need more precision than 7 decimals as can be read in the o5m documentation.

The coordinates are represented as two i32 internally.

Examples

let coordinate = Coordinate::new(70.95, -8.67);

// Get decimal numbers
assert_eq!(coordinate.lat(), 70.95);
assert_eq!(coordinate.lon(), -8.67);

// Access internal i32 numbers
assert_eq!(coordinate.lat, 709500000);
assert_eq!(coordinate.lon, -86700000);

// You can also use the `Into` trait to construct coordinates.
let coordinate: Coordinate = (70.95, -8.67).into();

Fields

lat: i32lon: i32

Methods

impl Coordinate[src]

pub fn new(lat: f64, lon: f64) -> Coordinate[src]

pub fn lat(self) -> f64[src]

pub fn lon(self) -> f64[src]

Trait Implementations

impl Add<Coordinate> for Coordinate[src]

type Output = Coordinate

The resulting type after applying the + operator.

impl Clone for Coordinate[src]

impl Copy for Coordinate[src]

impl Debug for Coordinate[src]

impl Eq for Coordinate[src]

impl From<(f64, f64)> for Coordinate[src]

impl Hash for Coordinate[src]

impl PartialEq<Coordinate> for Coordinate[src]

impl StructuralEq for Coordinate[src]

impl StructuralPartialEq for Coordinate[src]

impl Sub<Coordinate> for Coordinate[src]

type Output = Coordinate

The resulting type after applying the - operator.

Auto Trait Implementations

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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.