-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
Summary
When using --segment-speed-file to close a road segment, OSRM removes turn permissions at intersections that are not directly connected to the closed segment. This prevents routing from open segments, even when those segments are separated from the closed segment by intermediate nodes.
Environment
- OSRM version:
ghcr.io/project-osrm/osrm-backend:v6.0.0docker image - OSM data: New Zealand extract from Geofabrik (latest)
- Profile:
car.lua(default driving profile) from https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua - System: Ubuntu LTS 22.04
Problem Description
Consider a linear road arrangement with two consecutive segments that are a part of the same way:
|
|
|
------- Node A: -----------
Intersection
|
|
Segment A:
Normal speed (40 km/h)
|
|
Node B
|
|
Segment B:
Closed segment (0 km/h)
|
|
Node C:
------- Intersection -------
Closed Closed
Consider a house located on Segment A (the open segment between Node A and Node B). We request a route from this house to a destination to the north.
Expected Behaviour
- Segment B: Should be avoided by routing due to prohibitive speed (✓ expected)
- Segment A: Should be fully routable with normal turn permissions at Node A (✓ expected)
- Node A: Turn permissions should be unaffected since the closed segment doesn't connect to it
- A route from the house on Segment A should successfully navigate to Node A and turn onto other roads
Actual Behaviour
When requesting a route from the house on Segment A:
- Segment A still shows 40 km/h in debug mode (correct ✓)
- Segment B correctly shows 0 km/h in debug mode (correct ✓)
- The vehicle can travel along Segment A
- However, at Node A (the intersection), turn permissions are removed or blocked
- In
osrm-frontenddebug mode, when approaching Node A from Segment A, the turn indicators (left/straight/right arrows) are missing - No route can be found because the vehicle cannot execute any turn at Node A to leave Segment A
This is particularly unexpected because Node A and the closed Segment B are not directly connected - they are separated by Node B.
Visual Debug Evidence
Using osrm-frontend with debug mode enabled:
- Segment A shows correct 40 km/h speed ✓
- Segment B shows 0 km/h and is correctly avoided ✓
- Traveling along Segment A toward Node A: movement is allowed ✓
- At Node A (intersection): turn arrows are completely missing ✗
- Result: No route possible from Segment A because the vehicle cannot leave Node A
Minimal Reproduction
# Download necessary files, such as the car profile and New Zealand OSM data
mkdir data
wget https://raw.githubusercontent.com/Project-OSRM/osrm-backend/refs/heads/master/profiles/car.lua -O data/car.lua
wget https://download.geofabrik.de/australia-oceania/new-zealand-latest.osm.pbf -O data/nz-latest.osm.pbf
# Create a segment speed file to close a specific segment by setting the 3 segments connecting to Node B in both directions to 0 km/h
cat > data/segment_speeds.csv << EOF
5552089703,104536666,0
104536666,5552089703,0
5785426394,104536666,0
104536666,5785426394,0
5552089702,104536666,0
104536666,5552089702,0
EOF
# Extract, partition, and customize the OSRM data with the segment speed file
docker run -t -v ./data:/data --user $(id -u):$(id -g) ghcr.io/project-osrm/osrm-backend:v6.0.0 osrm-extract -p /data/car.lua /data/nz-latest.osm.pbf
docker run -t -v ./data:/data --user $(id -u):$(id -g) ghcr.io/project-osrm/osrm-backend:v6.0.0 osrm-partition /data/nz-latest.osrm
docker run -t -v ./data:/data --user $(id -u):$(id -g) ghcr.io/project-osrm/osrm-backend:v6.0.0 osrm-customize /data/nz-latest.osrm --segment-speed-file /data/segment_speeds.csv
# Start the OSRM routing server with MLD algorithm
docker run -d -it --cpus=1 -p 54781:5000 -v ./data:/data ghcr.io/project-osrm/osrm-backend:v6.0.0 osrm-routed --algorithm mld --max-table-size 100000 /data/nz-latest.osrm --threads 1
# Test a route that should be possible from Segment A to a destination north of Node A
curl "http://localhost:54781/route/v1/driving/172.73786544799805,-43.53516385006154;172.7371519804001,-43.533526582257004?overview=false&alternatives=true&steps=true"
# Response: {"message":"No route found between points","code":"NoRoute"}
# Run osrm-frontend to visualise and debug
docker run -p 9966:9966 -e OSRM_BACKEND='http://localhost:54781' ghcr.io/project-osrm/osrm-frontend:latest
Location and Real World Context
I am trying to route from 351 Estuary Road, Christchurch, New Zealand 43.535075,172.735684 (lon,lat) to a random point north of it.
