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

[common] Update to georust/geo v0.29.0 #328

Merged
merged 5 commits into from
Oct 31, 2024

Conversation

michaelkirk
Copy link
Contributor

@michaelkirk michaelkirk commented Oct 30, 2024

A lot of the line measure traits were re-worked: https://docs.rs/geo/latest/geo/#measures

Mostly this is just moving code around, consolidating in hopes of similar methods across metric spaces being easier to find now that they are uniform.

It also enabled replacing some mostly copy/pasted implementations in geo with generic implementations, which enabled some new functionality - e.g. we can now .densify::<Geodesic>

One notable behavioral change: the output of the new Bearing trait is now uniformly 0...360. Previously GeodesicBearing and HaversineBearing returned -180..180 while RhumbBearing returned 0...360. (see georust/geo#1210 for more)

This actually uncovered a bug in ferrostar, reflected in the new output of
ferrostar/src/snapshots/ferrostar__simulation__tests__state_from_polyline.snap

Since previously we were casting a potentially negative number to u16 — now it's always positive (0...360).

There are some other changes I'd like to make, but this represents a mostly drop in replacement for the current behavior.

A lot of the line measure traits were re-worked.

Mostly this is just moving code around in hopes of similar methods
across metric spaces being easier to find now that they are uniform.

It also enabled replacing some mostly copy/pasted implementations in geo
with generic implementations, which enabled some new functionality -
e.g. we can now `.densify::<Geodesic>`

One notable behavioral change: the output of the new `Bearing` trait is
now uniformly 0...360.  Previously GeodesicBearing and HaversineBearing
returned -180..180 while RhumbBearing returned 0...360.

georust/geo#1210

This actually uncovered a bug in ferrostar, reflected in the new output
of
ferrostar/src/snapshots/ferrostar__simulation__tests__state_from_polyline.snap

Since previously we were casting a potentially negative number to u16 —
now it's always positive (0...360).
common/ferrostar/src/algorithms.rs Show resolved Hide resolved
common/ferrostar/src/algorithms.rs Show resolved Hide resolved
// Compute total segment length in meters
let segment_length = segment_linestring.haversine_length();
let segment_length = segment_linestring.length::<Haversine>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, you could double down on the more accurate but slower segment_linestring.length::<Geodesic>()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, exactly. That's probably worth evaluating properly. I've opened #329 to follow up on this. This is probably a case where Geodesics could make sense. On the other hand, I am pretty sure Valhalla uses haversine exclusively and is generally fine 😂

common/ferrostar/src/models.rs Show resolved Hide resolved
@ianthetechie ianthetechie self-requested a review October 31, 2024 02:08
@ianthetechie ianthetechie merged commit 4b883ae into stadiamaps:main Oct 31, 2024
14 checks passed
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

Successfully merging this pull request may close these issues.

2 participants