Expand description
Line measurements like Bearing and Distance for various metric spaces like Euclidean, Haversine, Geodesic, and Rhumb.
§Example
use geo::{Haversine, Euclidean, Distance, Point, Bearing};
let p1: Point = Point::new(0.0, 0.0);
let p2: Point = Point::new(0.0, 2.0);
assert_eq!(Euclidean.distance(p1, p2), 2.0);
// The units of the output depend on the metric space.
// In the case of [`Haversine`], it's meters.
// See the documentation for each metric space for details.
assert_eq!(Haversine.distance(p1, p2).round(), 222_390.0);
// Due north
assert_eq!(Haversine.bearing(p1, p2), 0.0);See the individual metric_spaces or algorithm traits for more details.
Re-exports§
pub use metric_spaces::Euclidean;pub use metric_spaces::Geodesic;pub use metric_spaces::GeodesicMeasure;pub use metric_spaces::Haversine;pub use metric_spaces::HaversineMeasure;pub use metric_spaces::Rhumb;
Modules§
Traits§
- Bearing
- Calculate the bearing between two points.
- Densifiable
- Creates a copy of the geometry with additional points inserted as necessary to ensure there
is never more than
max_segment_lengthbetween points. - Densify
- Creates a copy of the geometry with additional points inserted as necessary to ensure there
is never more than
max_segment_lengthbetween points. - Destination
- Calculate the destination point from an origin point, given a bearing and a distance.
- Distance
- Calculate the minimum distance between two geometries.
- Frechet
Distance - Determine the similarity between two
LineStringsusing the Frechet distance. - Interpolatable
Line - A linear geometry (1-D) which can have a point interpolated partially into it.
- Interpolate
Line - Interpolate a
Pointalong aLineorLineString. - Interpolate
Point - Interpolate a
Pointalong a line between two existing points - Length
- Calculate the length of a
Line,LineString, orMultiLineStringusing a given metric space. - Length
Measurable - Something which can be measured by a metric space,
such as a
Line,LineString, orMultiLineString.