Weekend project: Live traffic density report for highways in Slovenia

Weekend project: Live traffic density report for highways in Slovenia

September 7, 2012 9:26 am

tl;dr
I made a weekend project, check the traffic density on Slovenia’s highways

During the summer vacation period there is usually more traffic on main roads than ordinary. And if you want to travel on these roads, the info about road density on your designated route can be really valuable.

Slovenia, the country I live in, unfortunately doesn’t have traffic density on Google Maps. The company that maintains the main roads and highways tries their best to inform drivers about the status on the web page promet.si. They provide all the latest info including live video feed from different roads and traffic forecast.

One of their features is the traffic density counter on checkpoints all around the country. There are 346 of them (normal roads both ways and highways both ways on driving lane and fast lane). The table on the page sorts these checkpoints by density, so at times the fast line and the driving line for one place in the same direction can be separated on the table.
Usually as a driver (or a codriver if we take safety into consideration – and we should) has little or no time to filter through the table and find out if he will have any troubles en route.
That is why I wanted to find out how difficult it would be to sort the data in a more driver (codriver) friendly way.

The goal was to make a working proof of concept just to take my mind off of improving mylpg.eu for a day or two.

I knew coding per se wouldn’t be a challenge, only the parsing was. The big challenge was how to make all this chunk of data super simple and still useful.

Firstly I eliminated all other roads and focused only on highways.

Our capital is more or less in the middle, so I split the highways into parts: from borders to Ljubljana and one for Ljubljana’s highway ring. Then I had to find all the checkpoints for both directions and for every lane. At some parts only one direction is covered and the checkpoints are not everywhere of equal distance in-between.

At the end I made two tables for each part of highway previously split; one for each direction, where the first was from the border to Ljubljana’s ring and the other from the ring to the border. Each table has two rows, where the first row is the fast lane and the second row is the driving lane. Each cell is a checkpoint with average speed, average distance between vehicles and the location. The background color of the cell is the indicator of the density; from green (normal traffic) to red (heavy traffic with traffic congestions).

traffic density on Slovenia's highways example

Each visitor can see the density of the given section of highway without the need to search around and read actual text.

All in all I know it could be done better but for a proof of concept and testing purposes I think I‘ve done a decent job. It is only in Slovenian language, but you can try it here (traffic density on Slovenia’s highways) and tell me what you think.

Comments are closed