From cbd1ea6b59f5beac5dfad8cd99b67014c4a8c37b Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 25 Oct 2024 14:19:40 -0700 Subject: [PATCH 1/3] Add InterpolatePoint::point_at_distance_between for line_measures. --- geo/CHANGES.md | 2 + .../line_measures/interpolate_point.rs | 14 ++-- .../metric_spaces/euclidean/mod.rs | 72 +++++++++++++++++++ .../line_measures/metric_spaces/geodesic.rs | 44 +++++++++++- .../line_measures/metric_spaces/haversine.rs | 29 +++++++- .../line_measures/metric_spaces/rhumb.rs | 25 +++++++ 6 files changed, 177 insertions(+), 9 deletions(-) diff --git a/geo/CHANGES.md b/geo/CHANGES.md index 260e1a7d8..1256b81c3 100644 --- a/geo/CHANGES.md +++ b/geo/CHANGES.md @@ -71,6 +71,8 @@ line_string.densify::(); line_string.densify::(); ``` +* Added `InterpolatePoint::point_at_distance_between` for line_measures. + * * Change IntersectionMatrix::is_equal_topo to now consider empty geometries as equal. * * Fix `(LINESTRING EMPTY).contains(LINESTRING EMPTY)` and `(MULTIPOLYGON EMPTY).contains(MULTIPOINT EMPTY)` which previously diff --git a/geo/src/algorithm/line_measures/interpolate_point.rs b/geo/src/algorithm/line_measures/interpolate_point.rs index 9119fb535..d53bc226e 100644 --- a/geo/src/algorithm/line_measures/interpolate_point.rs +++ b/geo/src/algorithm/line_measures/interpolate_point.rs @@ -2,13 +2,19 @@ use crate::{CoordFloat, Point}; /// Interpolate a `Point` along a line between two existing points pub trait InterpolatePoint { - /// Returns a new Point along a line between two existing points + /// Returns a new Point along a line between two existing points. /// /// See [specific implementations](#implementors) for details. - fn point_at_ratio_between(start: Point, end: Point, ratio_from_start: F) -> Point; + fn point_at_distance_between( + start: Point, + end: Point, + distance_from_start: F, + ) -> Point; - // TODO: - // fn point_at_distance_between(start: Point, end: Point, distance_from_start: F) -> Point; + /// Returns a new Point along a line between two existing points. + /// + /// See [specific implementations](#implementors) for details. + fn point_at_ratio_between(start: Point, end: Point, ratio_from_start: F) -> Point; /// Interpolates `Point`s along a line between `start` and `end`. /// diff --git a/geo/src/algorithm/line_measures/metric_spaces/euclidean/mod.rs b/geo/src/algorithm/line_measures/metric_spaces/euclidean/mod.rs index 715e21132..7e10e0c65 100644 --- a/geo/src/algorithm/line_measures/metric_spaces/euclidean/mod.rs +++ b/geo/src/algorithm/line_measures/metric_spaces/euclidean/mod.rs @@ -22,12 +22,68 @@ use num_traits::FromPrimitive; /// [metric spaces]: super pub struct Euclidean; +/// Interpolate Point(s) along a line on the [Euclidean plane]. +/// +/// [Euclidean plane]: https://en.wikipedia.org/wiki/Euclidean_plane impl InterpolatePoint for Euclidean { + /// Returns the point at the given distance along the line between `start` and `end`. + /// + /// # Units + /// - `distance`: Measured in whatever units your `start` and `end` points use. + /// + /// `distance` and your `start` and `end` points should have non-agular + /// units, like meters or miles, **not** lon/lat. + /// For lon/lat points, use the [`Haversine`] or [`Geodesic`] [metric spaces]. + /// + /// [`Haversine`]: crate::line_measures::Haversine + /// [`Geodesic`]: crate::line_measures::Geodesic + /// [metric spaces]: crate::line_measures::metric_spaces + fn point_at_distance_between( + start: Point, + end: Point, + distance_from_start: F, + ) -> Point { + let diff = end - start; + let total_distance = diff.x().hypot(diff.y()); + let offset = diff * distance_from_start / total_distance; + start + offset + } + + /// Returns the point at the given ratio along the line between `start` and `end`. + /// + /// # Units + /// - `distance`: Measured in whatever units your `start` and `end` points use. + /// + /// `distance` and your `start` and `end` points should have non-agular + /// units, like meters or miles, **not** lon/lat. + /// For lon/lat points, use the [`Haversine`] or [`Geodesic`] [metric spaces]. + /// + /// [`Haversine`]: crate::line_measures::Haversine + /// [`Geodesic`]: crate::line_measures::Geodesic + /// [metric spaces]: crate::line_measures::metric_spaces fn point_at_ratio_between(start: Point, end: Point, ratio_from_start: F) -> Point { let diff = end - start; start + diff * ratio_from_start } + /// Interpolates `Point`s along a line between `start` and `end`. + /// + /// As many points as necessary will be added such that the distance between points + /// never exceeds `max_distance`. If the distance between start and end is less than + /// `max_distance`, no additional points will be included in the output. + /// + /// `include_ends`: Should the start and end points be included in the output? + /// + /// # Units + /// - `max_distance`: Measured in whatever units your `start` and `end` points use. + /// + /// `max_distance` and your `start` and `end` points should have non-agular + /// units, like meters or miles, **not** lon/lat. + /// For lon/lat points, use the [`Haversine`] or [`Geodesic`] [metric spaces]. + /// + /// [`Haversine`]: crate::line_measures::Haversine + /// [`Geodesic`]: crate::line_measures::Geodesic + /// [metric spaces]: crate::line_measures::metric_spaces fn points_along_line( start: Point, end: Point, @@ -68,5 +124,21 @@ mod tests { distance.round() ); } + + #[test] + fn test_point_at_distance_between() { + let new_york_city = Point::new(-8_238_310.24, 4_942_194.78); + // web mercator + let london = Point::new(-14_226.63, 6_678_077.70); + let start = MetricSpace::point_at_distance_between(new_york_city, london, 0.0); + assert_relative_eq!(new_york_city, start); + + let midway = + MetricSpace::point_at_distance_between(new_york_city, london, 8_405_286.0 / 2.0); + assert_relative_eq!(Point::new(-4_126_268., 5_810_136.), midway, epsilon = 1.0); + + let end = MetricSpace::point_at_distance_between(new_york_city, london, 8_405_286.0); + assert_relative_eq!(london, end, epsilon = 1.0); + } } } diff --git a/geo/src/algorithm/line_measures/metric_spaces/geodesic.rs b/geo/src/algorithm/line_measures/metric_spaces/geodesic.rs index 1821f28de..63bc5b6df 100644 --- a/geo/src/algorithm/line_measures/metric_spaces/geodesic.rs +++ b/geo/src/algorithm/line_measures/metric_spaces/geodesic.rs @@ -134,6 +134,44 @@ impl Distance, Point> for Geodesic { /// /// [geodesic line]: https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid impl InterpolatePoint for Geodesic { + /// Returns a new Point along a [geodesic line] between two existing points on an ellipsoidal model of the earth. + /// + /// # Units + /// `meters_from_start`: meters + /// + /// # Examples + /// + /// ``` + /// # use approx::assert_relative_eq; + /// use geo::{Geodesic, InterpolatePoint}; + /// use geo::Point; + /// + /// + /// let p1 = Point::new(10.0, 20.0); + /// let p2 = Point::new(125.0, 25.0); + /// + /// let closer_to_p1 = Geodesic::point_at_distance_between(p1, p2, 100_000.0); + /// assert_relative_eq!(closer_to_p1, Point::new(10.81, 20.49), epsilon = 1.0e-2); + /// + /// let closer_to_p2 = Geodesic::point_at_distance_between(p1, p2, 10_000_000.0); + /// assert_relative_eq!(closer_to_p2, Point::new(112.20, 30.67), epsilon = 1.0e-2); + /// ``` + /// + /// # References + /// + /// This uses the geodesic methods given by [Karney (2013)]. + /// + /// [geodesic line]: https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid + /// [Karney (2013)]: https://arxiv.org/pdf/1109.4448.pdf + fn point_at_distance_between( + start: Point, + end: Point, + meters_from_start: f64, + ) -> Point { + let bearing = Self::bearing(start, end); + Self::destination(start, bearing, meters_from_start) + } + /// Returns a new Point along a [geodesic line] between two existing points on an ellipsoidal model of the earth. /// /// # Examples @@ -170,9 +208,7 @@ impl InterpolatePoint for Geodesic { let g = geographiclib_rs::Geodesic::wgs84(); let (total_distance, azi1, _azi2, _a12) = g.inverse(start.y(), start.x(), end.y(), end.x()); let distance = total_distance * ratio_from_start; - let (lat2, lon2) = g.direct(start.y(), start.x(), azi1, distance); - - Point::new(lon2, lat2) + Self::destination(start, azi1, distance) } /// Interpolates `Point`s along a [geodesic line] between `start` and `end`. @@ -335,6 +371,7 @@ mod tests { let midpoint = MetricSpace::point_at_ratio_between(start, end, 0.5); assert_relative_eq!(midpoint, Point::new(65.87936072133309, 37.72225378005785)); } + #[test] fn points_along_line_with_endpoints() { let start = Point::new(10.0, 20.0); @@ -347,6 +384,7 @@ mod tests { assert_eq!(route.last().unwrap(), &end); assert_relative_eq!(route[1], Point::new(17.878754355562464, 24.466667836189565)); } + #[test] fn points_along_line_without_endpoints() { let start = Point::new(10.0, 20.0); diff --git a/geo/src/algorithm/line_measures/metric_spaces/haversine.rs b/geo/src/algorithm/line_measures/metric_spaces/haversine.rs index dee062839..971e7504e 100644 --- a/geo/src/algorithm/line_measures/metric_spaces/haversine.rs +++ b/geo/src/algorithm/line_measures/metric_spaces/haversine.rs @@ -88,12 +88,12 @@ impl Destination for Haversine { /// the IUGG](ftp://athena.fsv.cvut.cz/ZFG/grs80-Moritz.pdf) /// /// [great circle]: https://en.wikipedia.org/wiki/Great_circle - fn destination(origin: Point, bearing: F, distance: F) -> Point { + fn destination(origin: Point, bearing: F, meters: F) -> Point { let center_lng = origin.x().to_radians(); let center_lat = origin.y().to_radians(); let bearing_rad = bearing.to_radians(); - let rad = distance / F::from(MEAN_EARTH_RADIUS).unwrap(); + let rad = meters / F::from(MEAN_EARTH_RADIUS).unwrap(); let lat = { center_lat.sin() * rad.cos() + center_lat.cos() * rad.sin() * bearing_rad.cos() } @@ -155,6 +155,31 @@ impl Distance, Point> for Haversin /// /// [great circle]: https://en.wikipedia.org/wiki/Great_circle impl InterpolatePoint for Haversine { + /// Returns a new Point along a [great circle] between two existing points. + /// + /// # Examples + /// + /// ``` + /// # use approx::assert_relative_eq; + /// use geo::{Haversine, InterpolatePoint}; + /// use geo::Point; + /// + /// let p1 = Point::new(10.0, 20.0); + /// let p2 = Point::new(125.0, 25.0); + /// + /// let closer_to_p1 = Haversine::point_at_distance_between(p1, p2, 100_000.0); + /// assert_relative_eq!(closer_to_p1, Point::new(10.81, 20.49), epsilon = 1.0e-2); + /// + /// let closer_to_p2 = Haversine::point_at_distance_between(p1, p2, 10_000_000.0); + /// assert_relative_eq!(closer_to_p2, Point::new(112.33, 30.57), epsilon = 1.0e-2); + /// ``` + /// + /// [great circle]: https://en.wikipedia.org/wiki/Great_circle + fn point_at_distance_between(start: Point, end: Point, meters_from_start: F) -> Point { + let bearing = Self::bearing(start, end); + Self::destination(start, bearing, meters_from_start) + } + /// Returns a new Point along a [great circle] between two existing points. /// /// # Examples diff --git a/geo/src/algorithm/line_measures/metric_spaces/rhumb.rs b/geo/src/algorithm/line_measures/metric_spaces/rhumb.rs index 9a8b0fa94..b13cd1b2d 100644 --- a/geo/src/algorithm/line_measures/metric_spaces/rhumb.rs +++ b/geo/src/algorithm/line_measures/metric_spaces/rhumb.rs @@ -130,6 +130,31 @@ impl Distance, Point> for Rhumb { /// /// [rhumb line]: https://en.wikipedia.org/wiki/Rhumb_line impl InterpolatePoint for Rhumb { + /// Returns a new Point along a [rhumb line] between two existing points. + /// + /// # Examples + /// + /// ``` + /// # use approx::assert_relative_eq; + /// use geo::{Rhumb, InterpolatePoint}; + /// use geo::Point; + /// + /// let p1 = Point::new(10.0, 20.0); + /// let p2 = Point::new(125.0, 25.0); + /// + /// let closer_to_p1 = Rhumb::point_at_distance_between(p1, p2, 100_000.0); + /// assert_relative_eq!(closer_to_p1, Point::new(10.96, 20.04), epsilon = 1.0e-2); + /// + /// let closer_to_p2 = Rhumb::point_at_distance_between(p1, p2, 10_000_000.0); + /// assert_relative_eq!(closer_to_p2, Point::new(107.00, 24.23), epsilon = 1.0e-2); + /// ``` + /// + /// [rhumb line]: https://en.wikipedia.org/wiki/Rhumb_line + fn point_at_distance_between(start: Point, end: Point, meters_from_start: F) -> Point { + let bearing = Self::bearing(start, end); + Self::destination(start, bearing, meters_from_start) + } + /// Returns a new Point along a [rhumb line] between two existing points. /// /// # Examples From 17c69b25ca23654524491eb1eeaf64f5e6278f2c Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 28 Oct 2024 12:11:07 -0700 Subject: [PATCH 2/3] reorganize frontpage docs to account for line_measures work --- geo/src/algorithm/line_measures/bearing.rs | 2 +- .../algorithm/line_measures/destination.rs | 2 +- geo/src/algorithm/line_measures/distance.rs | 2 +- geo/src/lib.rs | 64 +++++++++---------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/geo/src/algorithm/line_measures/bearing.rs b/geo/src/algorithm/line_measures/bearing.rs index d092ec9e8..67a1694e7 100644 --- a/geo/src/algorithm/line_measures/bearing.rs +++ b/geo/src/algorithm/line_measures/bearing.rs @@ -1,6 +1,6 @@ use geo_types::{CoordFloat, Point}; -/// Calculate the bearing between two points +/// Calculate the bearing between two points. pub trait Bearing { /// Calculate the bearing from `origin` to `destination` in degrees. /// diff --git a/geo/src/algorithm/line_measures/destination.rs b/geo/src/algorithm/line_measures/destination.rs index 91ffb73ef..513524937 100644 --- a/geo/src/algorithm/line_measures/destination.rs +++ b/geo/src/algorithm/line_measures/destination.rs @@ -1,6 +1,6 @@ use geo_types::{CoordFloat, Point}; -/// Calculate the destination point from an origin point, a bearing and a distance. +/// Calculate the destination point from an origin point, given a bearing and a distance. pub trait Destination { /// Returns a new point having travelled the `distance` along a line /// from the `origin` point with the given `bearing`. diff --git a/geo/src/algorithm/line_measures/distance.rs b/geo/src/algorithm/line_measures/distance.rs index e89749fb2..4ec9d994b 100644 --- a/geo/src/algorithm/line_measures/distance.rs +++ b/geo/src/algorithm/line_measures/distance.rs @@ -1,4 +1,4 @@ -/// Calculate the distance between the `Origin` and `Destination` geometry. +/// Calculate the minimum distance between two geometries. pub trait Distance { /// Note that not all implementations support all geometry combinations, but at least `Point` to `Point` /// is supported. diff --git a/geo/src/lib.rs b/geo/src/lib.rs index 4b69dd637..11cf8bc4a 100644 --- a/geo/src/lib.rs +++ b/geo/src/lib.rs @@ -31,32 +31,43 @@ //! //! # Algorithms //! -//! ## Area +//! ## Measures //! -//! - **[`Area`]**: Calculate the planar area of a geometry -//! - **[`ChamberlainDuquetteArea`]**: Calculate the geodesic area of a geometry on a sphere using the algorithm presented in _Some Algorithms for Polygons on a Sphere_ by Chamberlain and Duquette (2007) -//! - **[`GeodesicArea`]**: Calculate the geodesic area and perimeter of a geometry on an ellipsoid using the algorithm presented in _Algorithms for geodesics_ by Charles Karney (2013) +//! Algorithms for measures along a line, and how a line is measured. //! -//! ## Boolean Operations +//! ### Metric Spaces //! -//! - **[`BooleanOps`]**: combine or split (Multi)Polygons using intersecton, union, xor, or difference operations +//! - **[`Euclidean`]**: The [Euclidean plane] measures distance with the pythagorean formula. Not suitable for lon/lat geometries. +//! - **[`Haversine`]**: The [Haversine Formula] measures distance on a sphere. Only suitable for lon/lat geometries. +//! - **[`Geodesic`]**: Geodesic methods based on [Karney (2013)] more accurately reflect the shape of the Earth, but are slower than Haversine. Only suitable for lon/lat geometries. +//! - **[`Rhumb`]**: [Rhumb line] (a.k.a. loxodrome) measures can be useful for navigation applications where maintaining a constant bearing or direction is important. Only suitable for lon/lat geometries. //! -//! ## Distance +//! ### Operations on Metric Spaces +//! +//! - **[`Distance`]**: Calculate the minimum distance between two geometries. +//! - **[`Length`]**: Calculate the length of a `Line`, `LineString`, or `MultiLineString`. +//! - **[`Bearing`]**: Calculate the bearing between two points. +//! +//! - **[`Destination`]**: Calculate the destination point from an origin point, given a bearing and a distance. +//! - **[`InterpolatePoint`]**: Interpolate points along a line. +//! - **[`Densify`]**: Insert points into a geometry so there is never more than `max_segment_length` between points. +//! +//! ### Misc measures //! -//! - **[`EuclideanDistance`]**: Calculate the minimum euclidean distance between geometries -//! - **[`GeodesicDistance`]**: Calculate the minimum geodesic distance between geometries using the algorithm presented in _Algorithms for geodesics_ by Charles Karney (2013) //! - **[`HausdorffDistance`]**: Calculate "the maximum of the distances from a point in any of the sets to the nearest point in the other set." (Rote, 1991) -//! - **[`HaversineDistance`]**: Calculate the minimum geodesic distance between geometries using the haversine formula -//! - **[`RhumbDistance`]**: Calculate the length of a rhumb line connecting the two geometries //! - **[`VincentyDistance`]**: Calculate the minimum geodesic distance between geometries using Vincenty’s formula +//! - **[`VincentyLength`]**: Calculate the geodesic length of a geometry using Vincenty’s formula +//! - **[`FrechetDistance`]**: Calculate the similarity between [`LineString`]s using the Fréchet distance //! -//! ## Length +//! ## Area //! -//! - **[`EuclideanLength`]**: Calculate the euclidean length of a geometry -//! - **[`GeodesicLength`]**: Calculate the geodesic length of a geometry using the algorithm presented in _Algorithms for geodesics_ by Charles Karney (2013) -//! - **[`HaversineLength`]**: Calculate the geodesic length of a geometry using the haversine formula -//! - **[`RhumbLength`]**: Calculate the length of a geometry assuming it's composed of rhumb lines -//! - **[`VincentyLength`]**: Calculate the geodesic length of a geometry using Vincenty’s formula +//! - **[`Area`]**: Calculate the planar area of a geometry +//! - **[`ChamberlainDuquetteArea`]**: Calculate the geodesic area of a geometry on a sphere using the algorithm presented in _Some Algorithms for Polygons on a Sphere_ by Chamberlain and Duquette (2007) +//! - **[`GeodesicArea`]**: Calculate the geodesic area and perimeter of a geometry on an ellipsoid using the algorithm presented in _Algorithms for geodesics_ by Charles Karney (2013) +//! +//! ## Boolean Operations +//! +//! - **[`BooleanOps`]**: combine or split (Multi)Polygons using intersecton, union, xor, or difference operations //! //! ## Outlier Detection //! @@ -72,9 +83,6 @@ //! //! ## Query //! -//! - **[`HaversineBearing`]**: Calculate the bearing between points using great circle calculations. -//! - **[`GeodesicBearing`]**: Calculate the bearing between points on a [geodesic](https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid) -//! - **[`RhumbBearing`]**: Calculate the angle from north of the rhumb line connecting two points. //! - **[`ClosestPoint`]**: Find the point on a geometry //! closest to a given point //! - **[`HaversineClosestPoint`]**: Find the point on a geometry @@ -87,10 +95,6 @@ //! fraction of a line’s total length representing the location of the closest point on the //! line to the given point //! -//! ## Similarity -//! -//! - **[`FrechetDistance`]**: Calculate the similarity between [`LineString`]s using the Fréchet distance -//! //! ## Topology //! //! - **[`Contains`]**: Calculate if a geometry contains another @@ -156,14 +160,6 @@ //! //! - **[`Centroid`]**: Calculate the centroid of a geometry //! - **[`ChaikinSmoothing`]**: Smoothen `LineString`, `Polygon`, `MultiLineString` and `MultiPolygon` using Chaikin's algorithm. -//! - **[`Densify`]**: Densify linear geometry components by interpolating points -//! - **[`DensifyHaversine`]**: Densify spherical geometry by interpolating points on a sphere -//! - **[`GeodesicDestination`]**: Given a start point, bearing, and distance, calculate the destination point on a [geodesic](https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid) -//! - **[`GeodesicIntermediate`]**: Calculate intermediate points on a [geodesic](https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid) -//! - **[`HaversineDestination`]**: Given a start point, bearing, and distance, calculate the destination point on a sphere assuming travel on a great circle -//! - **[`HaversineIntermediate`]**: Calculate intermediate points on a sphere along a great-circle line -//! - **[`RhumbDestination`]**: Given a start point, bearing, and distance, calculate the destination point on a sphere assuming travel along a rhumb line -//! - **[`RhumbIntermediate`]**: Calculate intermediate points on a sphere along a rhumb line //! - **[`proj`]**: Project geometries with the `proj` crate (requires the `use-proj` feature) //! - **[`LineStringSegmentize`]**: Segment a LineString into `n` segments. //! - **[`LineStringSegmentizeHaversine`]**: Segment a LineString using Haversine distance. @@ -197,9 +193,12 @@ //! * [Geocoding][geocoding crate] //! * [and much more...][georust website] //! +//! [Euclidean plane]: https://en.wikipedia.org/wiki/Euclidean_plane //! [`geo-types`]: https://crates.io/crates/geo-types +//! [haversine formula]: https://en.wikipedia.org/wiki/Haversine_formula// //! [`proj` crate]: https://github.com/georust/proj //! [geojson crate]: https://crates.io/crates/geojson +//! [Karney (2013)]: https://arxiv.org/pdf/1109.4448.pdf //! [wkt crate]: https://crates.io/crates/wkt //! [shapefile crate]: https://crates.io/crates/shapefile //! [latlng crate]: https://crates.io/crates/latlon @@ -212,6 +211,7 @@ //! [network grid]: https://proj.org/usage/network.html //! [OGC-SFA]: https://www.ogc.org/standards/sfa //! [proj crate file download]: https://docs.rs/proj/*/proj/#grid-file-download +//! [rhumb line]: https://en.wikipedia.org/wiki/Rhumb_line //! [Serde]: https://serde.rs/ #[cfg(feature = "use-serde")] From 6851f2b139701c8bdc636ee48c82e15a992465db Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 28 Oct 2024 12:47:48 -0700 Subject: [PATCH 3/3] fixup typos and formatting --- geo/src/algorithm/densify_haversine.rs | 2 +- .../algorithm/line_measures/metric_spaces/euclidean/mod.rs | 6 +++--- geo/src/algorithm/line_measures/metric_spaces/geodesic.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/geo/src/algorithm/densify_haversine.rs b/geo/src/algorithm/densify_haversine.rs index 754779d83..e9ef38039 100644 --- a/geo/src/algorithm/densify_haversine.rs +++ b/geo/src/algorithm/densify_haversine.rs @@ -19,7 +19,7 @@ use crate::{ /// /// ## Units /// -/// `max_distance`: meters +/// - `max_distance`: meters /// /// # Examples /// ``` diff --git a/geo/src/algorithm/line_measures/metric_spaces/euclidean/mod.rs b/geo/src/algorithm/line_measures/metric_spaces/euclidean/mod.rs index 7e10e0c65..c30fdc933 100644 --- a/geo/src/algorithm/line_measures/metric_spaces/euclidean/mod.rs +++ b/geo/src/algorithm/line_measures/metric_spaces/euclidean/mod.rs @@ -31,7 +31,7 @@ impl InterpolatePoint for Euclidean { /// # Units /// - `distance`: Measured in whatever units your `start` and `end` points use. /// - /// `distance` and your `start` and `end` points should have non-agular + /// `distance` and your `start` and `end` points should have non-angular /// units, like meters or miles, **not** lon/lat. /// For lon/lat points, use the [`Haversine`] or [`Geodesic`] [metric spaces]. /// @@ -54,7 +54,7 @@ impl InterpolatePoint for Euclidean { /// # Units /// - `distance`: Measured in whatever units your `start` and `end` points use. /// - /// `distance` and your `start` and `end` points should have non-agular + /// `distance` and your `start` and `end` points should have non-angular /// units, like meters or miles, **not** lon/lat. /// For lon/lat points, use the [`Haversine`] or [`Geodesic`] [metric spaces]. /// @@ -77,7 +77,7 @@ impl InterpolatePoint for Euclidean { /// # Units /// - `max_distance`: Measured in whatever units your `start` and `end` points use. /// - /// `max_distance` and your `start` and `end` points should have non-agular + /// `max_distance` and your `start` and `end` points should have non-angular /// units, like meters or miles, **not** lon/lat. /// For lon/lat points, use the [`Haversine`] or [`Geodesic`] [metric spaces]. /// diff --git a/geo/src/algorithm/line_measures/metric_spaces/geodesic.rs b/geo/src/algorithm/line_measures/metric_spaces/geodesic.rs index 63bc5b6df..6e9ccb874 100644 --- a/geo/src/algorithm/line_measures/metric_spaces/geodesic.rs +++ b/geo/src/algorithm/line_measures/metric_spaces/geodesic.rs @@ -137,7 +137,7 @@ impl InterpolatePoint for Geodesic { /// Returns a new Point along a [geodesic line] between two existing points on an ellipsoidal model of the earth. /// /// # Units - /// `meters_from_start`: meters + /// - `meters_from_start`: meters /// /// # Examples ///