Written by
Ardit Xhaferi

Share this post!


← ../

24 Hours of Traffic in Prishtina during a Monday

June 18, 20225 min read

Traffic congestion is a major problem in many cities, including Prishtina. It can cause delays, air pollution, and frustration for drivers and pedestrians alike. In order to address this issue, it is important to understand the patterns and flow of traffic in the city. Visualizing traffic data can help us detect areas of congestion and develop strategies to improve the flow of traffic.


One way to visualize traffic data is to use the Google Maps API V3 Traffic Layer. This allows us to view real-time traffic information on a map of the city. By accessing this data and using technologies such as HTML, CSS, JS, Python, and Selenium, we can create a dynamic visualization of traffic in Prishtina.

Data Source

To create our visualization, we first need to access the traffic data using the Google Maps API V3 Traffic Layer. This can be done using Python and the Selenium library. Selenium allows us to automate the process of accessing and downloading the traffic data.


Once we have the traffic data, we can use Python and the Python Imaging Library (PIL) to create a visual representation of the traffic flow. This can be done by overlaying the traffic data on a map of the city and coloring the roads according to the level of traffic. For example, green could represent light traffic, yellow could represent moderate traffic, and red could represent heavy traffic.

In addition to showing the overall traffic flow, our visualization can also highlight areas of congestion. These are often referred to as "choke points" or "bottlenecks," and they can significantly impact the flow of traffic in the city. By identifying these areas, we can develop strategies to improve traffic flow and reduce congestion.

Improving Traffic Flow

One way to improve traffic flow is to focus on improving public transportation. This can include expanding bus and train networks, creating dedicated lanes for buses and other forms of public transportation, and implementing carpooling and ride-sharing programs. These measures can help to reduce the number of cars on the road and improve traffic flow in the city.

Another way to improve traffic flow is to invest in intelligent transportation systems (ITS). These systems use sensors, cameras, and other technologies to monitor traffic conditions in real-time. They can then provide real-time traffic updates and route recommendations to drivers, helping them to avoid congested areas and find the fastest route to their destination.

Open-Source Code

The code for this project is open-source and available on GitHub. If you would like to recreate this project or build upon it, you can find the code at the following link: https://github.com/ArditXhaferi/24-hours-of-traffic-prishtina


In conclusion, visualizing traffic data can be a valuable tool for understanding and improving the flow of traffic in Prishtina. By using the Google Maps API V3 Traffic Layer and other technologies, we can create dynamic visualizations that highlight areas of congestion and help us develop strategies to improve traffic flow in the city. By striving for better systems rather than more roads, we can make Prishtina a more efficient and livable city for everyone.

Published June 18, 2022, by Ardit Xhaferi.

You don't have to share this post, but if you feel like it: