Skip to content
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

Clarify that current CrossTrackDistance uses spherical (Haversine) earth model, add Ellipsoidal (Vincenty) version #1128

Open
urschrei opened this issue Dec 23, 2023 · 4 comments

Comments

@urschrei
Copy link
Member

https://docs.rs/geo/latest/geo/algorithm/cross_track_distance/trait.CrossTrackDistance.html

One approach would be:

  1. Deprecate cross_track_distance in favour of cross_track_distance_haversine
  2. Add cross_track_distance_geodesic (I think we have all the necessary pieces between geo and geographiclib_rs)
  3. Note the advantages / caveats related to WGS-84 (specifically: most WGS-84 coordinates won't be accurate to less than 1 m anyway)
@frewsxcv
Copy link
Member

frewsxcv commented Feb 6, 2024

A PR was opened for this here: #1140

@frewsxcv frewsxcv closed this as completed Feb 6, 2024
@frewsxcv frewsxcv reopened this Feb 6, 2024
@frewsxcv
Copy link
Member

frewsxcv commented Feb 6, 2024

(Didn't mean to close)

@michaelkirk
Copy link
Member

This would be a good candidate to revisit in light of the line measure work I've been doing.

I'd guess the API would look something like:

line.cross_track_distance::<Geodesic>(point)
line.cross_track_distance::<Haversine>(point)

Also, just to make sure I'm understanding correctly, isn't cross_track_distance exactly the same as Point x Line distance in a particular metric space?

e.g. we already have implementations:

impl Distance<Point, Point> for Haversine { ... }
impl Distance<Point, Point> for Geodesic { ... }

If we also had these implementations:

impl Distance<Line, Point> for Haversine { ... }
impl Distance<Line, Point> for Geodesic { ... }

Than these two are precisely the same thing:

line.distance::<Haversine>(point);
line.cross_track_distance::<Haversine>(point)

Is that right? Please correct me if I'm wrong, I've not worked with "cross track distance" as a concept by name before.

Regardless, even if they are equivalent, it might be worth having it filed under both names since "cross_track_distance" is apparently a term that people know and will try to find.

@michaelkirk michaelkirk changed the title Clarify that current cross-track distance uses spherical (Haversine) earth model, add Ellipsoidal (Vincenty) version Clarify that current CrossTrackDistance uses spherical (Haversine) earth model, add Ellipsoidal (Vincenty) version Oct 30, 2024
@michaelkirk
Copy link
Member

michaelkirk commented Oct 31, 2024

Than these two are precisely the same thing:

line.distance::<Haversine>(point);
line.cross_track_distance::<Haversine>(point)

Is that right? Please correct me if I'm wrong, I've not worked with "cross track distance" as a concept by name before.

That is wrong! CrossTrackDistance is measuring the distance to an infinite line passing through the segment. I mistakenly thought it was measuring the distance to the given line segment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants