calebp
September 28, 2020, 4:40pm
1
https://graphhopper.com/maps/?point=33.335853%2C-111.758895&point=33.315898%2C-111.608906&locale=en-US&vehicle=car&weighting=fastest&elevation=true&turn_costs=true&algorithm=alternative_route&use_miles=false&layer=Omniscale&ch.disable=true&u_turn_costs=5000
In this route, I set u_turn_costs to 5000 to essentially disable u-turns, but it doesn’t affect the route. According to the github doc below, I can choose u_turn_costs by disabling ch:
# How to work with Turn Restrictions
GraphHopper supports [turn restrictions](http://wiki.openstreetmap.org/wiki/Relation:restriction).
Turn restrictions are crucial for correct vehicle navigation and help to avoid forbidden turns.
[Without turn restrictions](https://graphhopper.com/maps/?point=23.1047%2C-82.44319&point=23.10544%2C-82.44316) (the turn is not allowed):

[With turn restrictions](https://graphhopper.com/maps/?point=23.1047%2C-82.44319&point=23.10544%2C-82.44316&ch.disable=true):

Turn restrictions have to be enabled on a vehicle basis. To enable it for one vehicle add
`|turn_costs=true` in the config, for example: `graph.flag_encoders=car|turn_costs=true`.
Or when using the Java API directly you can either create the encoding manager like `EncodingManager.create("car|turn_costs=true")` or
`new EncodingManager.Builder().add(new CarFlagEncoder(5, 5, 1)` where the last parameter of `CarFlagEncoder` represents
the maximum turn costs (a value of 1 means the turn can either be legal or forbidden).
Turn restrictions are not available for every vehicle as they have low relevance
for some vehicles like `foot`.
This file has been truncated. show original
This is currently not identified as U turn because different edges are used, i.e. this is an open issue.
calebp
September 28, 2020, 7:09pm
3
Pretty amazing how you and some others quickly respond. Thanks!
1 Like
system
Closed
December 27, 2020, 7:09pm
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.