Skip to content

Improve bike speed handling - #3214

Merged
karussell merged 23 commits into
masterfrom
fix_bike_speed
Oct 24, 2025
Merged

karussell merged 23 commits into
masterfrom
fix_bike_speed

Conversation

@karussell

@karussell karussell commented Oct 17, 2025 •

Copy link
Copy Markdown
Member

This change makes the bike speed more consistent across the different bike types. Here a link for easier comparison as the tests were restructured a bit (i.e. the link avoids the first two commits and the master commits).

Furthermore it tries to make the decision when to pick which speed more consistent. And the theory is that there are 4 cases bicycles=yes/no & surface=good/bad using different default assumptions:

  1. there are highways like tertiary, primary, ... where we assume by default: a) bicycles allowed and b) good surface
  2. for track we assume by default a) bicycles allowed and b) bad surface
  3. for footway, pedestrian and platform we assume by default a) bicycles not allowed and b) good surface
  4. for path and bridleway we assume by default a) bicycles not allowed and b) bad surface

And for cases 2. to 4. the speed can increase, because of allowed/designated bike access or a good surface.

Furthermore "bike designated" is also true if the way is part of an official bike network (taken from the relationFlags).

See previous discussion here.

@karussell karussell changed the title Fix bike speed Improve bike speed handling Oct 17, 2025

@ratrun ratrun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks excellent. I only detected one further suggestion.

GHResponse response = gh.route(req);
ResponsePath path = response.getBest();
assertEquals(5436, path.getDistance(), 5);
assertEquals(5158, path.getDistance(), 5);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question: Did you cross check the reason for this pretty big difference?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is the result of increasing the speed of highway=pedestrian from 4 to 6km/h resulting in this IMO more realistic route:

image

instead of this:

image

(Note that the OSM data in the repo is heavily outdated and the route in reality is something completely different. Also note that this test does not use bike.json and instead a simplified bike profile for testing purposes which is without e.g. soft reverse oneway.)

@karussell karussell added this to the 12.0 milestone Oct 21, 2025
@karussell
karussell merged commit bfa0f3c into master Oct 24, 2025
@karussell
karussell deleted the fix_bike_speed branch October 24, 2025 10:05
@karussell

Copy link
Copy Markdown
Member Author

Thanks for the discussion @ratrun!

This branch was previously deployed

1 inactive deployment
benchmarks — 047bcbf2 Deployed Oct 21, 2025 by karussell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants