When there is no valid routeA route corresponds to a path of a vehicle through the underlying transport network. The main attributes of a route are the distance and the time that the vehicle travels along the path. from start to destination, because there is at least one segment which is prohibited for the given vehicleThe term vehicle describes what is being routed or planned for. Vehicles are used in route calculation, distance matrix calculation and effectively also in tour planning. In route calculation, vehicle properties like overall size, weight and speed are in focus. In tour planning, it is vehicle properties like capacity and availability. Commonly a vehicle is motorized, like a truck - including its trailer or a car. However also a bike or even a pedestrian are included in this definition., the resulting route is marked as violated. A route is violated only if there is no other valid route.
Route violations are activated by default and can be controlled through the routing profileA profile is a collection of parameters used to configure the request. Full profiles consist of a number of specialized sub-profiles like the VehicleProfile which describes the properties of a vehicle. field Violations.enabled.
Routes are usually violated if one of the waypointsA waypoint is a geographic location used to specify start, destination and possible stopovers for a route. is on a road which is prohibited for the current vehicle, e.g. the vehicle is generally prohibited, exceeds a weight limit, carries hazardous goods, or violates some other regulation.
It may also happen that one of the waypoints is in an area which has only one access road which is prohibited for the vehicle, e.g. due to a height limit, or the access is restricted by a gate or bollard. See also Unreachable Route Location.
In case restrictions on road segments or nodes are violated the field RouteResponse.violated is set to true. The same flag is present for route legs, segments and nodes as well as for distance matrix relations.
In order to best find the violated segments or nodes along the route, there is a RouteViolationEvent for each kind of violation which contains more information including its reason. There is an event when entering an area and another one when exiting an area marked with the AccessType ENTER and EXIT. If the distance is less than 100 meters, the restriction is assumed to be passed such as a gate or a bridge, i.e. it is not considered to be an area. There is only one event marked with AccessType PASS.
Currently, prohibited segments and long-term traffic incidents can be violated.
Prohibited segments have a penalty of 2501. Very often access in pedestrian zones or other restricted areas is allowed for delivery vehicles. These segments have a penalty of 2501 if the flag isDelivery is not set. If it is set, i.e. the vehicle is marked as a delivery vehicle, the penalty is 2500 which has a similar effect on the route calculation, but there is no violated segment and no event. See the documentation of Feature Layer PTV_TruckAttributes for details on these regulations.
Long-term traffic incidents with a zero speed (such like road works that cause a road closure for several weeks) can also be violated. In this case, the travel time of the segments is the maximum travel time without this blocking.
Some violations are only available when using a PathWaypoint. For example, a path waypoint on an highway with a storedProfile
bicycle will result in a violated route.
When disabling route violations, such route requests result in a RouteNotFoundException.
Currently the following restrictions can produce violations:
Roads generally prohibited for cars are not fully supported, but it is guaranteed that a violated route does not contain a segment driving the wrong direction of a one-way road.
Usually, a route is violated only if there is no other valid route. In mountain areas or fjords it may happen that the route is violated even if there is a valid route as the detour is too long.