Toronto’s Traffic Lights Re-Visited and Animated

My map of Toronto’s traffic signals described in a post on April 4th, 2014, was recently published on the title page of Cartouche, the newsletter of the Canadian Cartographic Association (CCA). This is my first-ever published map that is stand-alone, not included in an article or other text document! Here is a screenshot of the newsletter title:

screenshot-cartouche-title-spring2014

Motivated by this unexpected outcome and using the occasion of the launch event of Maptime Toronto on May 29th, 2014, I wanted to try animating the dots representing the traffic signals. More precisely, each traffic light should iterate through a green-yellow-red sequence, and each mid-block pedestrian crossing should go through an off-blinking-off sequence. I was aiming for an animated GIF image with ten frames displayed in a continuous loop.

To create the colour sequences for each dot in QGIS, I copied the last digit of an existing  feature ID from the City of Toronto traffic signals data table into a new field to act as a random group assignment. Using a suggestion by Michael Markieta, I then created nine additional integer fields and cycled through the group numbers by adding 1. To keep these numbers in the 0…9 range, I used QGIS’ “modulo” function, e.g. Cycle1 = (“Cycle2” + 1) % 10. I then assigned the green, yellow, and red dot symbols from the static traffic lights map as a categorized “style” to different group numbers. Finally, I manually iterated the symbology through the ten group columns and took a screenshot each time. I put these together in the animated GIF shown below.

animation_25

I must admit that I am not super convinced of the outcome. Maybe, ten frames are not enough to overcome the clocked appearance of the traffic signal system. But at least, things are moving now :)

It is important to note that this animation does not show the real-time status of the traffic lights! In fact, there is only one dot for an entire intersection that would include two to four sets of vehicle traffic lights, plus pedestrian lights, etc. – all represented by the same green-yellow-red cycle on the map. I also made the assumption that the green and red phases are the same length (4 out of 10 ticks each, with the remaining 2 ticks used for the yellow phase). You will note that the mid-block crossings have an active phase with three on-off cycles followed by a longer off phase. In this case, it would be fancier to individually control each crossing and have it come on randomly.