U Turns not being disabled

I’m currently running a graphhopper server locally. I want to navigate from

# [lat, lon]    
points = [[25.128716, 55.416487], [25.124923, 55.415341], [25.122013, 55.411738]]

This gives a route like this:

which includes a uturn.

I’d like to make it so that this request doesn’t result in a uturn but instead results in a route like this:

I’m on v10.2 and I’m using the following config

profiles:
- name: car
turn_costs:
u_turn_costs: 1200
sharp_left_turn_costs: 1200
sharp_right_turn_costs: 1200
vehicle_types: [motorcar, motor_vehicle]
custom_model_files: [car.json]

profiles_lm:

graph.encoded_values: car_access, car_average_speed, orientation

prepare.min_network_size: 200
prepare.subnetworks.threads: 1

routing.non_ch.max_waypoint_distance: 1000000

graph.dataaccess.default_type: RAM_STORE

When I make a request I’ve tried using various combinations of the following options (note here the points are listed in [lon, lat])
request_data = {
“points”: [[55.416487, 25.128716], [55.415341, 25.124923], [55.411738, 25.122013]],
“profile”: “car”,
“locale”: “en”,
“instructions”: True,
“calc_points”: calc_points,
“points_encoded”: points_encoded,
“pass_through”: [False, True, False],
“heading_penalty”: 10000,
“ch.disable”: True,
“debug”: True,
“heading”: [168, 276, 240],
}

However none seem to eliminate that uturn. If anyone knows how to fix this / what I’m doing incorreclty, I’d really appreciate the help.

The pass_through parameter needs to be a single boolean instead of a list with one boolean per location as you tried.

Hi all, the solution was twofold.

  1. I had to edit pass_through as easbar suggested.
  2. I had to disable ch in the graphhopper config. For profile bus, pass through now works when I pass the above request.

profiles:
- name: car
turn_costs:
u_turn_costs: 180
vehicle_types: [motorcar, motor_vehicle]
custom_model_files: [car.json]
- name: bus
turn_costs:
u_turn_costs: 900
vehicle_types: [bus]
custom_model_files: [bus.json]

profiles_ch:
- profile: car

1 Like

Thanks for sharing your solution. Btw instead of disabling CH in the config you can only disable it in your request using ch.disable=true then you can run requests using CH (without pass_through) and requests not using CH (with pass_through) on the same server for the same profile.

I definitely tried that but I must have done something else incorrectly at the time because it didn’t work. I will go back and figure out what went wrong. Thanks