Trait proj::Coord [−][src]
pub trait Coord<T> where
T: CoordinateType, { fn x(&self) -> T; fn y(&self) -> T; fn from_xy(x: T, y: T) -> Self; }
Expand description
A point in two dimensional space. The primary unit of input/output for proj.
By default, any numeric (x, y)
tuple implements Coord
, but you can conform your type to
Coord
to pass it directly into proj.
See the geo-types
feature for interop with the geo-types
crate
Required methods
Implementations on Foreign Types
extern crate proj; use proj::Proj; use geo_types::Coordinate; let from = "EPSG:2230"; let to = "EPSG:26946"; let nad_ft_to_m = Proj::new_known_crs(&from, &to, None).unwrap(); let result = nad_ft_to_m .convert(Coordinate { x: 4760096.421921f64, y: 3744293.729449f64 }) .unwrap(); assert_relative_eq!(result.x, 1450880.29f64, epsilon=1.0e-2); assert_relative_eq!(result.y, 1141263.01f64, epsilon=1.0e-2);
extern crate proj; use proj::Proj; use geo_types::Point; let from = "EPSG:2230"; let to = "EPSG:26946"; let nad_ft_to_m = Proj::new_known_crs(&from, &to, None).unwrap(); let result = nad_ft_to_m .convert(Point::new(4760096.421921f64, 3744293.729449f64)) .unwrap(); assert_relative_eq!(result.x(), 1450880.29f64, epsilon=1.0e-2); assert_relative_eq!(result.y(), 1141263.01f64, epsilon=1.0e-2);