Struct geom::LonLat[][src]

pub struct LonLat {
    longitude: NotNan<f64>,
    latitude: NotNan<f64>,
}

Represents a (longitude, latitude) point.

Fields

longitude: NotNan<f64>latitude: NotNan<f64>

Implementations

impl LonLat[src]

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

Note the order of arguments!

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

Returns the longitude of this point.

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

Returns the latitude of this point.

pub fn to_pt(self, b: &GPSBounds) -> Pt2D[src]

Transform this to a world-space point. Can go out of bounds.

pub(crate) fn gps_dist(self, other: LonLat) -> Distance[src]

Returns the Haversine distance to another point.

pub fn fast_dist(self, other: LonLat) -> NotNan<f64>[src]

Pretty meaningless units, for comparing distances very roughly

pub fn read_osmosis_polygon(path: &str) -> Result<Vec<LonLat>>[src]

Parses a file in the https://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format and returns all points.

pub fn write_osmosis_polygon(path: &str, pts: &[LonLat]) -> Result<()>[src]

Writes a set of points to a file in the https://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format. The input should be a closed ring, with the first and last point matching.

pub fn center(pts: &[LonLat]) -> LonLat[src]

Finds the average of a set of coordinates.

pub fn parse_wkt_linestring(raw: &str) -> Option<Vec<LonLat>>[src]

Parses a WKT-style line-string into a list of coordinates.

Trait Implementations

impl Clone for LonLat[src]

impl Copy for LonLat[src]

impl Debug for LonLat[src]

impl<'de> Deserialize<'de> for LonLat[src]

impl Display for LonLat[src]

impl Eq for LonLat[src]

impl From<LonLat> for Point<f64>[src]

impl Ord for LonLat[src]

impl PartialEq<LonLat> for LonLat[src]

impl PartialOrd<LonLat> for LonLat[src]

impl Serialize for LonLat[src]

impl StructuralEq for LonLat[src]

impl StructuralPartialEq for LonLat[src]

Auto Trait Implementations

impl RefUnwindSafe for LonLat

impl Send for LonLat

impl Sync for LonLat

impl Unpin for LonLat

impl UnwindSafe for LonLat

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.