Symptom
A planTours request is configured with tunnelRestrictionCode: "B" and PTV_TruckAttributes enabled. The API response returns "routeViolated": true, but the calculated routes are not modified to avoid ADR-restricted tunnels — the itinerary still passes through forbidden segments.
Cause
The request uses "$type": "ExistingDistanceMatrix" as the distance mode. When a precomputed distance matrix is referenced:
- All leg distances and routes are already fixed at matrix-calculation time.
- planTours does not invoke the detailed routing engine during tour optimization.
- ADR / tunnel restrictions are detected and flagged (routeViolated: true), but the engine cannot recalculate an alternate route to avoid the violation.
- The route profile used during optimization comes from the HPR definition — not from parameters passed in the planTours request body.
Attention: ADR constraints are correctly detected but cannot be enforced when using a precomputed ExistingDistanceMatrix. This is an architectural limitation, not a configuration error.
Resolution
1- Ensure the HPR is created with the full correct profile, including both PTV_TruckAttributes and tunnelRestrictionCode. With ExistingDistanceMatrix, planTours reads the vehicle profile from the HPR — parameters passed in the request body are not used for routing.
{
"requestProfile": {
"featureLayerProfile": {
"themes": [
{ "id": "PTV_TruckAttributes", "enabled": true }
]
},
"vehicleProfile": {
"load": {
"tunnelRestrictionCode": "B"
}
}
}
}2-Rebuild the distance matrix using this corrected HPR. The matrix must be recomputed with the ADR-aware profile for restrictions to be baked into the precomputed legs.
3- If dynamic ADR restriction is required per tour (e.g. the vehicle is not always loaded), avoid ExistingDistanceMatrix for those tours. Use direct routing mode so planTours can invoke the routing engine with the exact profile provided at request time.
4- Verify the configuration works first with a simple xRoute call before testing planTours. This isolates whether the issue is profile configuration vs. matrix behavior.
Related articles
PTV xServer: HPR created successfully via API but does not appear in the HPR list
PTV xServer 2: Height Violations Disappear or Route Changes When Adding a Waypoint