Symptom
When calculating a route using xRoute with a truck profile (e.g. height = 5.00 m) and height restrictions enabled (CFL_Hauteur):
- The initial route contains several ROUTE_VIOLATION_EVENTs related to height constraints.
- When an intermediate waypoint is added on the original route geometry:
- The route changes unexpectedly.
- Previously reported height violations disappear.
This behavior can appear inconsistent from a business perspective, especially in regulated transport scenarios.
Cause
This behavior is related to the routing algorithm search space configuration, not necessarily to incorrect data or a defect.
By default:
- The routing algorithm (Dijkstra-based) prioritizes higher network classes (major roads such as highways and primary roads — NC0 to NC2), especially when far from waypoints.
- In areas with many restrictions (e.g. height constraints from CFL_Hauteur), the algorithm may:
- Remain on higher-class roads
- Accept constraint violations if no alternative is found in the explored search space
When a waypoint is added:
- The routing problem is recalculated in multiple segments
- The search space is altered
- The algorithm may explore additional roads
- This can lead to:
- A different route
- Avoidance of previously detected violations
Additionally, if the CFL contains advanced attributes (e.g. preferred segments or other routing influences), they may further affect route calculation.
Resolution
To ensure that the routing engine explores more alternatives and avoids unnecessary violations, configure the search space explicitly in the routing request.
Step 1: Update the routing request
replace:
"searchSpace": null
with:
"searchSpace": {
"excludeByNetworkClass": {
"minimumDistancesFromWaypoint": [
"UNBOUNDED",
"UNBOUNDED",
"UNBOUNDED",
"UNBOUNDED",
50,
20,
10,
10
]
}
}
Step 2: Effect of the configuration
This configuration:
- Expands the exploration of lower network classes (secondary roads)
- Allows the algorithm to find detours
- Reduces reliance on major roads only
- Helps avoid height violations instead of accepting them
Step 3: Validate results
After applying the configuration:
- Recalculate the route without waypoint
- Recalculate with waypoint
- Compare:
- Route geometry
- Presence of violations
You should observe:
- More consistent routing behavior
- Reduced or eliminated violations where alternatives exist
Related articles
PTV xServer 2: RouteNotFoundFault when using truck profiles with PTV_TruckAttributes enabled
PTV xServer: Content Update Service (CUS) - Port 1099 already in use