Link Search Menu Expand Document

Calculating Transit Passengers Volumes on Links

Requirements: Network, Events, Transit Schedule, Transit Vehicles

The tutorial Average Speeds and Volumes on Links explains how to calculate the number of vehicles on links. But for public transport, this number is often irrelevant. Rather, the number of passengers is typically of more interest. The following short tutorial explains how the number of passengers in transit vehicles on links can be calculated. This is especially useful if multiple transit lines (or even transit routes) share the same stop sequence and the total passengers count of all lines or routes serving this stop sequence is of interest.

Data preparation

  1. Add the network file, events file, transitSchedule and transitVehicles files to Via.
  2. Create the following layers:
    • Network
    • Agents (from Events)
    • Vehicles (from Events)
    • Transit Schedule base visualization
  3. Open the Network layer’s settings dialog.
  4. Select Link Attributes, then click on Add and select Aggregate Vehicle Attributes.
    creating the attributes
  5. Set the options according to the screenshot above:
    • Set Attribute to [PT] #Passengers.
    • Set Aggregation to Sum.
    • Set Measure when to Vehicle enters link.
    • Give it a useful name.
  6. Click on Create Attribute. 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, you can select it in the attributes list and adapt the settings if necessary. The time resolution influences over which time window the aggregation is performed.
    set time window


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

  1. Hide the Vehicle layer, Agent layer, and the Transit Schedule layer.
  2. Open the Network layer’s settings dialog.
  3. Set the link color to type Attribute Mapping and select the newly create ptPax attribute.
  4. Click on the small gear icon next to the plus and minus buttons below the color table and select Histogram.
  5. Create a nice color ramp based on the maximum value from the Histogram. set visualization style
  6. Set the link width to type Attribute Mapping and select the ptPax attribute.
  7. Create a matching link-width distribution. set visualization style
  8. 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 settings as provided above, links where a high number of transit passengers are transported will be shown in bright yellow, while links with a lower number of passengers are red or purple. Blue links have no transit passengers at all.


The MATSim network contains links for private car and for transit. Thus, in the above visualizations, not only links served by public transport are visiable, but all links in the network, which can give a misleading impression.

This can be fixed by only showing links for public transportation. Typically, such links offer additional modes next to car. This allows to set the transparency of links to 0.0 (meaning fully opaque) for links that have one of the modes used by public transport, and set the transparency to 100.0 for all other links, which in that case hopefully should be the car links.

If this “filtering” with the allowed transport mode is not possible, one could just hide all links with a value of zero for ptPax. “Hiding” in this case again involves transparency, setting a fully transparent color for 0, and an opaque color for 1.