-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify line measurement traits (tracking issue) #1181
Comments
Oh man, the plot thickens. Maybe we shouldn't just get rid of I don't have a solution yet and have run out of time to think about this today, but I'm open to proposals about how to re-align things to increase uniformity and decrease redundancy. |
One option would be to have an fn intermediate_haversine(start: &Point, end: &Point, prop: f64) {}
fn intermediate_geodesic(start: &Point, end: &Point, prop: f64) {}
fn intermediate_euclidean(start: &Point, end: &Point, prop: f64) {}
fn intermediate_rhumb(start: &Point, end: &Point, prop: f64) {} |
I spent a while trying to understand our existing "measurement" traits - see the new table in the issue description. It exposes a bit of overlap, some inconsistencies, and some missing functionality. There are also some "similar/related" traits that don't exactly fit the pattern, which I've labeled as "oddballs". |
I've rescoped this issue a bit and fleshed out some of the details. I hope to have the first PR improving (I think!) the situation by the end of today. |
|
All of these algorithm implementations already existed, but I'm proposing a new way to organize them which I hope will be more consistent and discoverable. Note: The new Haversine::bearing and Geodesic::bearing return 0..360, the legacy traits HaversineBearing and GeodesicBearing returned -180..180 Additional changes: Deleted the deprecated `Bearing` trait which was previously superceeded by the unambiguous `HaversineBearing` trait, but now is re-defined as `Haversine::bearing` = Future Work = In an effort to minimize this PR, while keeping the change reasonably coherent, I've left some things out == Methods on Euclidean == -[ ] bearing (doesn't currently exist) -[ ] destination (doesn't currently exist) -[ ] intermediate (exists, but InterpolatePoint trait also needs intermediate_fill) -[ ] intermediate_fill (doesn't currently exist) == Deprecate Legacy Traits == -[ ] Deprecate Legacy impls -[ ] Switcheroo the actual implementation: move the actual implementation to the new traits, and have the legacy traits delegate to the new traits. -[ ] Move over any tests from the legacy implementation to the new home == Methods on Geoms (Future PR) == -[ ] Length -[ ] Haversine -[ ] Rhumb -[ ] Geodesic -[ ] Euclidean -[ ] Densify -[ ] Haversine -[ ] Rhumb -[ ] Geodesic -[ ] Euclidean FIXES #1210 FIXES #1181
All of these algorithm implementations already existed, but I'm proposing a new way to organize them which I hope will be more consistent and discoverable. Note: The new Haversine::bearing and Geodesic::bearing return 0..360, the legacy traits HaversineBearing and GeodesicBearing returned -180..180 Additional changes: Deleted the deprecated `Bearing` trait which was previously superceeded by the unambiguous `HaversineBearing` trait, but now is re-defined as `Haversine::bearing` = Future Work = In an effort to minimize this PR, while keeping the change reasonably coherent, I've left some things out == Methods on Euclidean == -[ ] bearing (doesn't currently exist) -[ ] destination (doesn't currently exist) -[ ] intermediate (exists, but InterpolatePoint trait also needs intermediate_fill) -[ ] intermediate_fill (doesn't currently exist) == Deprecate Legacy Traits == -[ ] Deprecate Legacy impls -[ ] Switcheroo the actual implementation: move the actual implementation to the new traits, and have the legacy traits delegate to the new traits. -[ ] Move over any tests from the legacy implementation to the new home == Methods on Geoms (Future PR) == -[ ] Length -[ ] Haversine -[ ] Rhumb -[ ] Geodesic -[ ] Euclidean -[ ] Densify -[ ] Haversine -[ ] Rhumb -[ ] Geodesic -[ ] Euclidean FIXES #1210 FIXES #1181
All of these algorithm implementations already existed, but I'm proposing a new way to organize them which I hope will be more consistent and discoverable. Note: The new Haversine::bearing and Geodesic::bearing return 0..360, the legacy traits HaversineBearing and GeodesicBearing returned -180..180 Additional changes: Deleted the deprecated `Bearing` trait which was previously superceeded by the unambiguous `HaversineBearing` trait, but now is re-defined as `Haversine::bearing` = Future Work = In an effort to minimize this PR, while keeping the change reasonably coherent, I've left some things out == Methods on Euclidean == -[ ] bearing (doesn't currently exist) -[ ] destination (doesn't currently exist) -[ ] intermediate (exists, but InterpolatePoint trait also needs intermediate_fill) -[ ] intermediate_fill (doesn't currently exist) == Deprecate Legacy Traits == -[ ] Deprecate Legacy impls -[ ] Switcheroo the actual implementation: move the actual implementation to the new traits, and have the legacy traits delegate to the new traits. -[ ] Move over any tests from the legacy implementation to the new home == Methods on Geoms (Future PR) == -[ ] Length -[ ] Haversine -[ ] Rhumb -[ ] Geodesic -[ ] Euclidean -[ ] Densify -[ ] Haversine -[ ] Rhumb -[ ] Geodesic -[ ] Euclidean FIXES #1210 FIXES #1181
It's in there! We don't currently have implementations for all the algorithms for Euclidean, but I'd like to add them in a followup.
Ah yes! I forgot about that issue. I just opened #1216 which takes a similar direction, though I haven't included the length trait yet. It's already a huge PR, so I'm trying to omit things when possible, while still keeping the codebase coherent enough to be deployed. |
I'm going to re-open this as a tracking issue since there are several other things I'd like to accomplish under this umbrella. I'll update the description soon. |
As part of aligning all our line measure traits (see #1181), all the Point x Point distance calculations had been moved into `line_measures::metric_spaces`. Euclidean space is the only space that implements distance calculations on *non* point geometries. This commit moves all those calculations onto the `line_measures::metric_spaces::Euclidean` so that we can fully deprecate the existing EuclideanDistance trait.
As part of aligning all our line measure traits (see #1181), all the Point x Point distance calculations had been moved into `line_measures::metric_spaces`. Euclidean space is the only space that implements distance calculations on *non* point geometries. This commit moves all those calculations onto the `line_measures::metric_spaces::Euclidean` so that we can fully deprecate the existing EuclideanDistance trait.
As part of aligning all our line measure traits (see #1181), all the Point x Point distance calculations had been moved into `line_measures::metric_spaces`. Euclidean space is the only space that implements distance calculations on *non* point geometries. This commit moves all those calculations onto the `line_measures::metric_spaces::Euclidean` so that we can fully deprecate the existing EuclideanDistance trait.
As part of aligning all our line measure traits (see #1181), all the Point x Point distance calculations had been moved into `line_measures::metric_spaces`. Euclidean space is the only space that implements distance calculations on *non* point geometries. This commit moves all those calculations onto the `line_measures::metric_spaces::Euclidean` so that we can fully deprecate the existing EuclideanDistance trait.
As part of aligning all our line measure traits (see #1181), all the Point x Point distance calculations had been moved into `line_measures::metric_spaces`. Euclidean space is the only space that implements distance calculations on *non* point geometries. This commit moves all those calculations onto the `line_measures::metric_spaces::Euclidean` so that we can fully deprecate the existing EuclideanDistance trait.
As part of aligning all our line measure traits (see #1181), all the Point x Point distance calculations had been moved into `line_measures::metric_spaces`. Euclidean space is the only space that implements distance calculations on *non* point geometries. This commit moves all those calculations onto the `line_measures::metric_spaces::Euclidean` so that we can fully deprecate the existing EuclideanDistance trait.
As part of aligning all our line measure traits (see #1181), all the Point x Point distance calculations had been moved into `line_measures::metric_spaces`. Euclidean space is the only space that implements distance calculations on *non* point geometries. This commit moves all those calculations onto the `line_measures::metric_spaces::Euclidean` so that we can fully deprecate the existing EuclideanDistance trait.
As part of aligning all our line measure traits (see #1181), all the Point x Point distance calculations had been moved into `line_measures::metric_spaces`. Euclidean space is the only space that implements distance calculations on *non* point geometries. This commit moves all those calculations onto the `line_measures::metric_spaces::Euclidean` so that we can fully deprecate the existing EuclideanDistance trait.
We have a lot of algorithms (bearing, destination, distance, etc.) implemented across different metric spaces (haversine, euclidean, geodesic), and the current arrangement, arrived at organically, can be pretty confusing.
e.g. It took me a while to realize that we already have haversine corollaries to some euclidean methods. Same problem in #1208.
I think we can rearrange things to be more obvious and discoverable to users
TODO
Length
trait One Length trait to rule them all 💍 #256Densify
trait unify Densify trait (adds support for Geodesic, Rhumb) #1231InterpolatePoint::point_at_distance_between
(current API only supports point_at_ratio_between: Add InterpolatePoint::point_at_distance_between for line_measures. #1235LineInterpolatePoint
trait for LineString (name tbd)LineLocatePoint
trait for LineString (name tbd)LineSegmentize
trait for LineStringDistance::Output
associated type might do it.distance<Vincenty>
, can we then impl falliblelength<Vincenty>
?Haversine::distance(Line, Point)
: AddHaversine:distance
for Line vs. Point (same as CrossTrackDistance) #1243point.cross_track_distance<MetricSpace>(line)
for at least Euclidean and Haversine (maybe rhumb? I'm not sure there's an analytical solution for Geodesic)geo
crate root docs index #1238Proposal introducing new line measures pattern
Introduce a
struct
per metric space:Introduce a unified trait per algorithm, and implement that trait on each struct:
NOTES
Current Measurement Traits
Here our existing traits that seem at least somewhat related to the notion at hand. I don't intend to unify all of these, but there are some definite patterns that I think we can capture to make things more intuitive to people.
As a csv: measurements.csv
Rendered:
/cc @JivanRoquet original author of the HaversineIntermediate trait in #230
/cc @JosiahParry original author of the DensifyHaversine trait in #1081
The text was updated successfully, but these errors were encountered: