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

configure turn cost calculation #2957

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open

configure turn cost calculation #2957

wants to merge 32 commits into from

Conversation

karussell
Copy link
Member

@karussell karussell commented Mar 25, 2024

Attempt to fix #1590.

Use cases:

  • avoid left turns for motor vehicles
  • avoid zig zag routes e.g. for bike like described in Prefer cycleway=lane for bike #1500.
  • avoid dense areas via avoiding too many junctions to get similar results like when using urban_density and avoiding CITY.
  • exclude too sharp turns for e.g. trucks.

Configuration to avoid zig zag routes for bike:

  graph.encoded_values: orientation
  profiles:
    - name: bike
      turn_costs:
        left: 6
        right: 6
        vehicle_types: [bicycle]
      custom_model_files: [bike.json]

The implementation fills an orientation encoded value where the forward value stores the orientation of the end segment of the edge and the backward value stores the orientation of the start segment of the edge. With that all turn angles can be calculated. Of course sometimes a "left turn" cannot be detected from the angle alone and topology must be considered but for now this orientation approach works good enough (and the topology approach did not work that well alone when I tried it before).

A more sophisticated implementation could also use different turn costs depending on the country or road_class but this and a request-based customization of the turn costs (moving it into the custom_model) should not be part of this PR.

@karussell karussell added this to the 10.0 milestone Apr 24, 2024
…support indicated that only a single coordinate is affected
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.

Using turn costs, not just turn restrictions
1 participant