[go: up one dir, main page]

Module line_measures

Module line_measures 

Source
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§

metric_spaces

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_length between points.
Densify
Creates a copy of the geometry with additional points inserted as necessary to ensure there is never more than max_segment_length between points.
Destination
Calculate the destination point from an origin point, given a bearing and a distance.
Distance
Calculate the minimum distance between two geometries.
FrechetDistance
Determine the similarity between two LineStrings using the Frechet distance.
InterpolatableLine
A linear geometry (1-D) which can have a point interpolated partially into it.
InterpolateLine
Interpolate a Point along a Line or LineString.
InterpolatePoint
Interpolate a Point along a line between two existing points
Length
Calculate the length of a Line, LineString, or MultiLineString using a given metric space.
LengthMeasurable
Something which can be measured by a metric space, such as a Line, LineString, or MultiLineString.