Link Search Menu Expand Document

Calculating Average Speeds and Volumes on Links

Requirements: Network, Events

Instead of looking at single vehicles, it is often helpful to look at links and see, if traffic on that link runs at near-free speed, or if the speed is reduced heavily due to congestion. This short tutorial will show how average link speeds and volumes can be calculated in Via, and how it can be visualized to gain a quick visual impression of the traffic state.

The volumes and speeds are extracted directly from the events, and not from already loaded vehicles. This allows to analyze very large scenarios, for which the vehicle trajectories could not be loaded due to the required memory to store them.

Data preparation

  1. Add the network and events file to Via.
  2. Create a Network Layer.
    base visualization
  3. Open the Network layer’s settings dialog.
  4. Select Link Attributes, then click on Add and select Avg. Speeds and Volumes.
    creating the attributes
  5. Select the previously added events file, and optionally enter an Identifier. This identifier is useful if you load the average speeds and volumes from multiple runs to compare them.
  6. Click on Create Attributes. A progress bar in the layer’s panel will show the progress of loading the necessary data.
    attributes loading
  7. After the attribute has been fully loaded, select the attributes (Volumes (absolute), Volumes (relative)) in the attributes list and adapt the settings if necessary. Especially if you visualize a population sample only, make sure to set the multiplier correctly (e.g. set it to 10 for a 10% sample, or to 4 for a 25% sample). The time resolution influences over which time window the average will be calculated.
    set mulitplier


After the necessary attributes are created and properly configured, the network can be visualized making use of the new attributes.

  1. Open the Network layer’s settings dialog.
  2. Set the link color to type Attribute Mapping and select the Volumes (relative) attribute.
    set visualization style
  3. Set the link width to type Attribute Mapping and select the Volumes (absolute) attribute.
  4. Click on OK

This should result in a visualization similar to the one shown below. Change the time of day and observe the different visualizations.
final visualization

Visual Analysis

With the above settings, highly saturated links are shown in green. Note that these are not links with congestion, as in these cases the actual traffic volume might be much lower than the actual free flow capacity. With the additional width setting depending on the absolute volume, the visualization shows where large numbers of vehicles are moving in the network.


Instead of coloring the links with the average volume (either relative or absolute), it is also possible to color the links using the Avg. Speeds (relative) attribute. The relative average speed of a link is its average speed, relative to its freespeed, as defined in the link. In MATSim, vehicles typically travel very close to freeflow speed, unless there are more vehicles on a link than the flow capacity allows for. In such cases, the vehicles are held back in MATSim, resulting in a longer travel time on that link and thus a lower speed.

By coloring the links by the relative average speeds, those links with a low relative speed can be highlighted, representing the links that are congested. This can be combined with setting the links’ width based on the links’ fixed flow capacities. In this case, traffic jams on major roads will be more visible than traffic jams on minor roads.