Struct flat_projection::FlatProjection [] [src]

pub struct FlatProjection<T: Float> { /* fields omitted */ }

Projection from WGS84 to a cartesian coordinate system for fast geodesic approximations.

let (lon1, lat1) = (6.186389, 50.823194);
let (lon2, lat2) = (6.953333, 51.301389);

let proj = FlatProjection::new(51.05);

let p1 = proj.project(lon1, lat1);
let p2 = proj.project(lon2, lat2);

let distance = p1.distance(&p2);
// -> 75.648 km

Methods

impl<T: Float> FlatProjection<T>
[src]

[src]

Creates a new FlatProjection instance that will work best around the given latitude.

let proj = FlatProjection::new(51.);

[src]

Converts a longitude and latitude (in degrees) to a FlatPoint instance that can be used for fast geodesic approximations.

let (lon, lat) = (6.186389, 50.823194);

let proj = FlatProjection::new(51.);

let flat_point = proj.project(lon, lat);

[src]

Converts a FlatPoint back to a (lon, lat) tuple.

let (lon, lat) = (6.186389, 50.823194);

let proj = FlatProjection::new(51.);

let flat_point = proj.project(lon, lat);

let result = proj.unproject(&flat_point);

assert_eq!(result.0, lon);

assert_eq!(result.1, lat);

Trait Implementations

impl<T: Debug + Float> Debug for FlatProjection<T>
[src]

[src]

Formats the value using the given formatter. Read more

impl<T: Copy + Float> Copy for FlatProjection<T>
[src]

impl<T: Clone + Float> Clone for FlatProjection<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: PartialEq + Float> PartialEq for FlatProjection<T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl<T: PartialOrd + Float> PartialOrd for FlatProjection<T>
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

impl<T> Send for FlatProjection<T> where
    T: Send

impl<T> Sync for FlatProjection<T> where
    T: Sync