Calculating the Best Route for Rush Hour Traffic

This article discusses the use case of calculating a routeClosed A 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. by taking into account a typical rush hour traffic situation.

Benefits

By considering the time of the day for a route calculation in conjunction with the Feature Layer themes PTV_SpeedPatterns and PTV_TrafficIncidents it is possible to get realistic and accurate information about ETAClosed ETA (Estimated Time of Arrival) is the time when a ship, vehicle, aircraft, cargo or emergency service is expected to arrive at a certain place. and ETDClosed ETD (Estimated Time of Departure) is the time when a ship, vehicle, aircraft, cargo or emergency service is expected to leave a certain place. for a trip. It is also possible to compare the travel times for a trip starting (or ending) at different points in time. This allows for example to determine the typical time loss when driving a route during rush hour in comparison to hours with less traffic.

Prerequisites

Check if the following prerequisites are fulfilled before you start with the use case.

  • Installed and licensed PTV xRoute service.

  • Installed map includes Luxembourg by HERE with the Feature Layer themes PTV_SpeedPatterns and PTV_TrafficIncidents.

Concepts

The Feature Layer PTV_SpeedPatterns defines average speeds on roads at different times of a day.
The Feature layer PTV_TrafficIncidents defines the speed on roads where some incidents are ongoing.
With the requestOption timeConsideration it is then possible to define the way how the time should be considered and thus which average speeds should be taken into account. For details see the technical concept about time consideration.

Regarding this speed over time data there are several possibilities to deal with time consideration:

ExactTimeConsiderationAtStart,ExactTimeConsiderationAtArrival

This kind of time consideration provides the most accurate results because it evaluates all time dependent data at the exact time at which the data is reached by the vehicleClosed The 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.. But there are drawbacks of this solution, too:

  • The calculation is somehow slow because no optimization can be used.
  • The traffic situation considered in routing cannot be reflected exactly on the map because these exact time consideration scenarios are not supported by the xMap service. Instead a snapshot time consideration can be used to approximate the situation of the time dependent data on the map.

SnapshotTimeConsideration

This kind of time consideration provides less accurate results than the exact time consideration because it evaluates all time dependent data at the given reference time and not at the exact time at which the data is reached by the vehicle. The resulting effect is that the longer the route the bigger gets the error of the ETA / ETD. Regarding the use case of a typical (and not dedicated) traffic situation these differences may be acceptable at least for short (e.g. urban) routes.

On the other hand the performance of this kind of calculation is much better than the exact time consideration because all typical calculation optimization techniques are applied.

Additional improvements

The use of additional Feature Layers like PTV_TruckAttributes may improve the results regarding the route course and the travel time by considering (time dependent) blockings and/or construction sites.

Programming Guide

The example below shows the calculation of a route in conjunction with the Feature Layers PTV_SpeedPatterns and PTV_TrafficIncidents. Therefor the JavaScript bindings to the xRoute service API is used:

In the example above one route is calculated twice with the same reference time but different time consideration scenarios. Some of the speed values along the route are changing during the time of the route. This leads to different resulting travel times, because the exact time consideration scenario reflects these changes but the snapshot time consideration scenario does not. The travel time of both calculations is displayed in the result line. The requestOption timeConsideration it is adjusted in the calculateSpecificRoute JavaScript callback function. For further information about the way this sample is implemented see the use-case Calculating a route.

Related Topics