How much has traffic in Ticino
changed in the last 60 years?
About traffic
Why is it important to analyze traffic and what are the consequences?
As you know, traffic congestion is a major issue affecting cities and urban areas. With population growth and urban expansion, the number of vehicles on the roads has significantly increased in recent decades. This problem leads to serious consequences, including traffic jams, air pollution, noise, longer travel times, an increase in road accidents, and a negative impact on the quality of life.
Switzerland Data 2023
New vehicles
Registration
=
Change
2022 - 2023
CO2 Emissions
By Traffic
=
Over
Total CO2 Emissions
What about traffic in Ticino?
This website has been created to analyze traffic trends in Ticino from 1963 to 2023. It aims to show how traffic has been influenced by crises and pandemics, as well as highlight areas more prone to high traffic volumes in Ticino. This research can be valuable to organizations working to improve traffic conditions, as well as to local citizens.
This visualization has been created using a dataset provided by the Federal Roads Office (USTRA)
How Has Traffic Evolved in Switzerland Over the Last 60 Years?
Actions: The visualization has been created using Unity, a powerful 3D engine specialized in video game making.
Importing the necessary files in Unity (final_dataset.csv) and the 3D model of Switzerland made using Blender
Creating scripts to manage the csv file (in C#), converting the file into a dictionary of dictionaries (basically: dict{station1:{month: value,...}, station2: {...}...})
With other scripts, creating station objects in the map, with coordinates manually assigned searching in google maps
Another script assignes each station object to its own canton
Every station objects merges into a canton object
A script which assigned to every station object its values (its dictionary) makes the mean between all the stations in a canton object. Now each canton object contains a dictionary (basically: dict{month: value, month2: value2...})
Another script makes every canton iterates through the values at the same time, assigning the color and size based on the them.
In the mean time, another script manages throught the calculation of a mean between all the values the creation of the red graph, using a Unity Line Renderer to create a line with y based on values and x based on time passing
A Final script manages the whole animation durations and the texts appearing on screen
Finally, a video of the Rendering Window of Unity has been recorded.
The data measured over the past 60 years shows that the
average daily number of vehicles
across counting stations in Switzerland has consistently been on the rise. More specifically, in cantons/zones such
as Zürich, Agrovia, Basel, Valais, Geneva, and Ticino, there has been more significant growth, with average values exceeding 60,000 vehicles.
It is also noteworthy that, despite having a relatively small population of 357,720, Ticino displays high values when compared to other similar cantons like Fribourg and Thurgau.
What About the Trend of the Mean in the Entire Switzerland?
Actions: The visualization has been created using D3.js, a javascript library used to create Scalable Vectorial Graphics
The final_dataset.csv have been modified by calculating the total mean between all the stations for every year
This dataset have been saved into another dataset (total_year_means.csv) that contained two columns: Year and Value
A scale has been created by using the width and height of the svg and the max value (for y) and first and last year (1963-2023) for x
Points have been placed by using the values and the year, iterating through the values in the dataset (using the same scale as the y axis). Each point is an object that has functionalities, like on mouse over which triggers a tooltip
Each point is connected to the next one using an interpolated line, so that it is smoothed and more pleasent to the eye
Going into more detail by analyzing the average data from all the stations across Switzerland, we can observe a consistent growth trend over the years, with an increase of 545% over the past 60 years. Furthermore, there is a noticeable sharp decline around 2019, due to the Covid-19 pandemic, which led to a decrease of approximately 23%.
Now let's analyze Ticino in detail.
Ticino is a relatively small canton in Switzerland, with a total population of 357,720. A significant portion of its wealth comes from tourism. Now that we have an overview of Switzerland, let's look into general trends in Ticino, areas with higher traffic volumes, and annual traffic patterns.
Actions: The visualization has been created using D3.js, a javascript library used to create Scalable Vectorial Graphics
From the dataset (final_dataset.csv), only rows where the Canton was "TI" were extracted
This smaller dataset contained only stations in Ticino
A scale has been created by using the width and height of the svg and the max value (for y) and first and last year (1963-2023) for x
Points have been placed by using the values and the year, iterating through the values in the dataset (using the same scale as the y axis). Each point is an object that has functionalities, like on mouse over which triggers a tooltip
Each point is connected to the next one using an interpolated line, so that it is smoothed and more pleasent to the eye
In the last years, traffic in Ticino has followed an upward trend, except for two significant events. The first occurred around 2008 during the financial crisis, where we can observe a 40% decrease, possibly due to the lack of tourism, which drastically reduced the annual average. Analyzing the Covid-19 period, we notice a decrease of about 50%, caused by both lockdowns and the absence of tourism. What is particularly interesting is comparing the decline in Ticino with the national average in Switzerland, which shows the importance of the flow driven by workers and tourists, as the Swiss average was impacted by approximately 23%. The final observation pertains to the period after Covid-19, where we can notice that traffic levels have not yet returned to the same values as before.
Actions: The visualization has been created using D3.js, a javascript library used to create Scalable Vectorial Graphics
From the original dataset (final_dataset.csv), only the columns of the last year have been extracted (2023)
From that smaller part, only rows where Canton was "TI" have been extracted
This smaller dataset contained only the values from January 2023 to December 2023 of the stations in Ticino
A scale has been created by using the width and height of the svg and the max value (for y) and the months of the year (January-December) for x
A boolean controls the displayed data, if it set to true, it will show a mean between all the stations in the dataset, else it will show the 6 stations that achieved the highest traffic among all years.
Each point is connected to the next one using an interpolated line, so that it is smoothed and more pleasent to the eye
A legend is created inside the graph. It is only shown when the top 6 station are shown, not in the mean visualization. A listener have been added to each square in the legend and it controls wether the related station is shown or not.
Analyzing the trend over the year (2023), we can observe a clear pattern. Starting from January, there is a strong increase in traffic on the roads, reaching its peak around June and August, before declining again towards December. This is due to the various movements during vacation periods, with families traveling abroad and tourists arriving in Ticino to spend their holidays.
Worse places in Ticino
Now let's take a closer look at how traffic is distributed in the Ticino area. Is it primarily influenced by the number of people coming from central Switzerland, or is it driven by the daily commuters who travel to work across the border?
Actions: The visualization has been created using D3.js, a javascript library used to create Scalable Vectorial Graphics
From the original dataset (final_dataset.csv) only rows where Canton was "TI" were extracted, and the Year_mean columns were removed resulting in a dataset from 1963 to 2023 of only Ticino stations and only months.
The scale is a dynamic object that updates every time with the maximum value of the top station
Iterating through the dataset created, the top 6 stations in a month are extracted
The slider controls the month that is shown (it is divided into all the months from January 1963 to December 2023)
By using the values of the top 6 stations, bars are created with size relative to the value and y position relative to the position in the top 6
Additionally, a map have been created, and points are placed inside it with coordinates, size and colors relative to the stations
The colors of the points is grayed if the stations are not in the top 6, else they have the same colors of the bars
A on mouse over event is added to the bars that allows the point on the map relative to the bar where the mouse is hovering to flash a green color, to allow users to identify the station between the others.
The functionality to hide and show the map is added, by using a stretching of both the map and the graph
Additionally, a play button has been added to make the slider move on its own, effectively showing automatically the whole timeline
By analyzing the top 6 counting stations from 2003 to 2023, we can observe that the flow of vehicles between central Switzerland and Ticino, passing through the Moleno Nord counting station (A2 motorway), is the area with the highest vehicle volume, reaching an average of 100,000 vehicles per day. In addition to this station, we also notice high values at the Grancia, Lugano C stations, and an increase around 2017 at Chiasso, near the Italian border.
The dataset is created by using a previously saved file, that thanks to openstreetmap contained the main roads in Ticino, along with their coordinates and their speed limits
Using those coordinates, every 30 minutes a function runs through all the streets in the original file, and sends a request to the TomTom Api, which returns the average speed in those coordinates.
This value is saved in a file that is created every day (t_data_dd_mm_yyyy.csv). This file contains as many rows as the original one, but contains columns for each time the traffic speed is recorded (street_coordinates, 00_00, 00_30, ..., 23_30).
To create the map, OpenStreetMap is used once again
Every line is plotted by using the coordinates in the selected file, and the color is related to traffic_speed / speed_limit of the selected hour
The selected date (using the date selection box) is used to load the file (for example, loading the file the 10/01/2025 will open the file t_data_10_01_2025.csv)
The hour shown is selected by using the slider, which sends its value to a function that searches in the loaded file the selected hour and shows the line colors related to that.
This map has been created for daily use, as it shows the average vehicle speed, updated every 30 minutes. An interesting observation is the central area of Lugano, where even during non-peak times, such as in the evening, the average speed remains much lower than the permitted speed limit. This is due to the presence of many traffic lights, which slow down movement. As a result, this can lead to an increase in traffic even when the number of vehicles is low.
Final Summary
Through this analysis, we have observed that both at the national level in Switzerland and at the Ticino level, the issue of traffic congestion continues to rise. We have also noticed that traffic in Ticino is heavily influenced by the presence of both tourists and cross-border workers, as well as by significant events like the Covid-19 pandemic. In terms of annual trends, we observed a sharp increase in traffic between June and August, largely due to the vacation period. This influx is driven by both local residents traveling and the many tourists who visit Ticino during the summer months. As for the most congested roads, the areas around Lugano and the A2 motorway, which leads to the San Gottardo Pass, experience the highest traffic volumes. The A2 serves as a key route for both daily commuters and tourists, contributing to its heavy traffic.
Alessandro Carnio, Sergio Fernandez, Mirko Keller
SUPSI 2024/2025, Bachelor in Data Science and Artificial Intelligience Data Visualization Course by Giovanni Profeta