Flattening Traffic Congestion

An analysis of how COVID-19 has changed our driving patterns

David Hurley
Towards Data Science

--

DisclaimerHealth or COVID: Note from our editors

I spend a lot of time on British Columbia’s Sea to Sky highway commuting between my home in Squamish and my work in Vancouver. As a result, I think about traffic…a lot. I know that Monday to Friday if I leave my house in Squamish at 6:45 AM versus 7:00 AM I can avoid congestion and cut 10 minutes off my work commute. I know that leaving work any later than 4:00 PM puts me in bumper-to-bumper traffic over the Ironworkers Bridge and that Vancouver to Squamish “weekend warrior” traffic on Friday afternoons can leave me in a soul-sucking standstill in North Vancouver. I also know that weekend congestion on the Sea to Sky highway, particularly long weekends or big snow days at Whistler, can be just as bad if not worse than weekdays.

You would think that with all this information I could avoid all traffic congestion and minimize my driving time. WRONG. I still get stuck in city stop-and-go, highway merge backups, and weather-related slowdowns. I could just accept this as reality, but being someone who prefers hard data to observations I decided to put some numbers to the Vancouver and Sea to Sky highway traffic congestion.

So what does COVID-19 have to do with any of this?

Turns out that in the process of building my data set I ended up capturing the impact of social distancing and non-essential services shutdowns on Vancouver and Sea to Sky traffic congestion. The results show more than the obvious conclusion that there is less traffic on the roads, they suggest a shift in peoples driving habits and travel tendencies, meaning fewer commuters, “weekend warriors”, long-weekend family camping trips, and sightseers.

Objectives

My focus was on the impact of COVID-19 on traffic congestion in Vancouver and the Sea to Sky highway. Specifically, I wanted to answer a few key questions:

  1. What has been the overall impact on daily traffic congestion?
  2. How has traffic congestion during the workweek and rush hour been impacted?
  3. Has traffic congestion on the weekend changed (i.e. are people traveling less for personal reasons)?

Collecting the data

I collected drive time data from the Google Maps Distance Matrix API and stored it in an Amazon Web Services (AWS) DynamoDB database. The data was collected using Python code run on a schedule in AWS Lambda. The Distance Matrix API allowed me to request the estimated drive time between two points as if I were departing now. This is the same as punching in the destination on my Google Maps phone app and getting an estimated driving time.

I collected the data every 30 minutes between October 17, 2019 and April 13, 2020 for 4 routes, to/from downtown Vancouver and Squamish and to/from East-Vancouver and Squamish. Only Vancouver to Squamish and East-Vancouver to Squamish data is presented in this article. These two routes are both major commuting thoroughfares but differ by one major factor, the East-Vancouver to Squamish route bypasses downtown Vancouver.

By limiting my Google Maps API requests to 4 routes and using the AWS free tier for Lambda and DynamoDB services I owed nothing in the end. Once I had collected a useful data set I wrote some Python code and exported the data from DynamoDB to a CSV file on my local machine where I cleaned and visualized the data in a Jupyter Notebook.

Routes from Squamish to downtown Vancouver (left) and East-Vancouver (right)

Exploring the data

Drive times are an easy traffic metric to collect and can reveal a lot about traffic trends. Look at the figure below showing drive times between Vancouver and Squamish and East-Vancouver and Squamish in 2020. Both routes see a spike (i.e. peaks) in drive times during the morning and evening rush hour and a lull at night (i.e. troughs). This is especially apparent in the East-Vancouver to Squamish record where spikes in drive times come in groups of 5 and correspond to Monday through Friday (e.g. week of January 20, 2020). Also, notice the outliers (largest spikes) in both records. These represent events that increase the drive times beyond what average rush hour traffic alone could do, such as the snowstorm in mid-January.

Drive times for Vancouver to Squamish (top) and East-Vancouver to Squamish (bottom) in 2020

The impact of COVID-19 on drive times JUMPS OFF THE PAGE! On March 16, Prime Minister Justin Trudeau announced major actions to combat COVID-19. I treated this date as the “start” of COVID-19 in British Columbia (at least in terms of impact to drive times). Drive times recorded after this date decreased dramatically. In fact, the difference between the middle of the night and rush hour drive times is almost gone (i.e. peaks and troughs are closer)!

A few things to note about this data set:

  1. Google Maps uses location data to help estimate drive times. This means the fewer Google Maps users there are on the road the more variability there is in drive time estimates (i.e. less data=more uncertainty). For example, one car on the highway going 140 km/h in the middle of the night would cause Google to estimate shorter drive times. Contrary, one car stopped on the highway in the middle of the night would cause Google to estimate longer drive times. I have seen Google Maps show a slowdown (i.e. red map color) in the middle of the night because a single car pulled over.
  2. Drive times correspond to routes that have both city and highway segments. This means increased drive time along a route could be due to more traffic in the city while the highway is clear and vice-versa. Therefore, it’s important to remember that this data set can only summarize overall trends for the route and not trends on a single roadway.

Congestion Level Index

While drive times are great for visualizing traffic trends such as rush hour and weather delays, it’s not that easy to interpret. For example, if I told you it took me 60 minutes to drive from A to B yesterday and 70 minutes today you would assume that today there was traffic. However, if I told you the average time to drive from A to B was 55 minutes you would assume there was traffic both days. But if instead of 55 minutes I said the average was 75 minutes you would assume there was minimal traffic both days. See the problem? Drive times don’t directly tell you how much traffic congestion there was (i.e. was there more or less traffic than average).

To counter this, I created a traffic congestion level index defined as the percent difference between drive times and the average Monday through Friday drive time at 2:00 AM (i.e. the baseline). I assumed the average Monday through Friday drive time at 2:00 AM represented the drive time without traffic or what traffic experts refer to as Free Flow.

When looking at the data just keep these points in mind:

  • A positive congestion level means there is more traffic on the route than would be observed on average at 2:00 AM.
  • A negative congestion level means there is less traffic on the route than would be observed on average at 2:00 AM.
  • Congestion levels are for the entire route and don’t say anything about where on the route the congestion was (i.e. during rush hour congestion is likely in the city and not on the highway far from the city).

Look at the figure below showing traffic congestion between Vancouver and Squamish and East-Vancouver and Squamish in 2020. Both routes see an increase in traffic congestion between 10% and 20% during rush hour. Increases beyond this correspond to “unforeseen” events such as traffic accidents and inclement weather (e.g. the snowstorm in mid-January). Notice that during the snowstorm the congestion, even in the middle of the night, was elevated. But why would there be more traffic in the middle of the night in a snowstorm? Remember the previous section, Google Maps uses location data to estimate drive times, so if there are a few people driving in the snowstorm, and inevitably driving slowly, then Google will estimate a long drive time which translates to increased congestion.

Overall, the congestion level index provides greater insight than drive times alone but is not without its flaws (i.e. increased congestion in the snowstorm or the lack of clarity on the location of congestion).

Congestion level for Vancouver to Squamish (top) and East-Vancouver to Squamish (bottom) in 2020

Daily Congestion

Q: What has been the overall impact on daily traffic congestion?

The next two figures show the average traffic congestion you would encounter on the Vancouver to Squamish and East-Vancouver to Squamish routes between 7:00 AM and 7:00 PM on a given day of the week pre- and post-March 16, 2020.

The figure doesn’t need a lot of explanation. The impact of COVID-19 has been a reduction in traffic congestion for all days of the week on both routes. The Vancouver to Squamish route saw a reduction in traffic congestion from 8%-10% to less than 4% during the week and 5%-6% to less than 2% on the weekend. The East-Vancouver to Squamish route saw a reduction in traffic congestion from 6%-9% to less than 1% during the week and 2%-4% to less than -1% on the weekend. The negative congestion level for the East-Vancouver to Squamish route indicates there is now less traffic on average between 7:00 AM and 7:00 PM than there was at 2:00 AM prior to COVID-19. WOW!

The impact of COVID-19 on daily traffic congestion for Vancouver to Squamish
The impact of COVID-19 on daily traffic congestion for East-Vancouver to Squamish

Hourly Congestion — Weekdays

Q: How has rush hour traffic been impacted?

Daily traffic congestion reveals high-level trends but hourly traffic congestion really tells us what part of people's lives is being impacted by COVID-19. The next two figures show the average traffic congestion you would encounter on the Vancouver to Squamish and East-Vancouver to Squamish routes each hour between 7:00 AM and 7:00 PM during the workweek pre- and post-March 16, 2020.

Not surprisingly, there has been a reduction in traffic congestion in all hours with the biggest decrease in traffic congestion occurring during the rush hour. Also, both routes have negative or near-negative traffic congestion in the evening post-COVID-19. This indicates that not only are people not going to work but they are staying home during the workweek, no doubt a function of business being closed. This is staggering that a major metropolitan city has almost no traffic congestion at 6:00 PM!

The impact of COVID-19 on hourly traffic congestion in the workweek for Vancouver to Squamish
The impact of COVID-19 on hourly traffic congestion in the workweek for East-Vancouver to Squamish

Hourly Congestion — Weekends

Q: How has weekend traffic been impacted?

The next two figures show the average traffic congestion you would encounter on the Vancouver to Squamish and East-Vancouver to Squamish routes each hour between 7:00 AM and 7:00 PM during the weekend pre- and post-March 16, 2020.

Prior to COVID-19, if you were heading from Vancouver or East-Vancouver to Squamish for a day of biking, skiing, or Gondola beer drinking and left after 10:00 AM you’d be in for a slow drive. Now, you’d still be better off leaving early but even if you left at noon the traffic congestion is considerably less. This suggests that not only are people not commuting to work and staying home in the evening during the workweek but they are driving less on the weekends for personal reasons.

The impact of COVID-19 on hourly traffic congestion on the weekend for Vancouver to Squamish
The impact of COVID-19 on hourly traffic congestion on the weekend for East-Vancouver to Squamish

Hourly Congestion — Sunny/Warm Weekends

Q: Are people still driving the Sea to Sky highway on warm-sunny weekends?

The next two figures show the average traffic congestion you would encounter on the Vancouver to Squamish and East-Vancouver to Squamish routes each hour between 9:00 AM and 14:00 PM during weekends pre-March 16, 2020 and select weekends pre- and post-March 16, 2020.

The Sea to Sky highway takes drivers through Squamish and Whistler and is a popular highway to access outdoor recreation. My thought process was that people tend to drive the Sea to Sky highway more in nice weather when outdoor activities are more popular and so looking at congestion trends on warm-sunny weekends would give more insight into how many “visitors” there are to Squamish.

The results are fairly convincing. The highest congestion level corresponded to a warm-sunny weekend in November 2019. On this weekend, congestion was significantly above even the average pre-COVID-19 weekend congestion level. What is more stunning is the decrease in congestion on warm-sunny weekends post-COVID-19. In fact, the least congested weekend post-COVID-19 was a beautiful Easter weekend, one that normally would have seen thousands of drivers on the Sea to Sky highway.

On a more personal level, the most interesting piece of data is the weekend of March 21/22. On this weekend there were confirmed news reports of hundreds of people hiking the Stawamus Chief (a popular trail in Squamish) and following these reports, there were claims that it was mostly people from Vancouver failing to follow COVID-19 social distancing practices and driving to Squamish. If this is true, I would have expected to see congestion levels more similar to pre-COVID-19 averages. Especially since social distancing means drivers are no longer carpooling which would suggest more cars on the road to get the same number of people to a location.

Instead, I think a more plausible answer is the supposed increase in tourists may be a larger percentage of local residents than expected. Consider this, there are fewer people working and those who are working are working from home on semi-flexible schedules. Additionally, there has been a push for people to limit their exposure to extreme sports such as backcountry skiing and climbing during COVID-19. All of this combined suggests there are fewer places to recreate and more local people with free time to do so.

The impact of COVID-19 on hourly traffic congestion for select weekends for Vancouver to Squamish
The impact of COVID-19 on hourly traffic congestion for select weekends for East-Vancouver to Squamish

Conclusion

I got lucky in that my dataset was collected before and after the start of COVID-19 measures leaving me with an interesting story to tell, but my findings are not alone. All over the world, including other Canadian cities, traffic congestion is decreasing.

The main takeaway is the following:

  • There are fewer drivers on the road, period. Both weekday rush hour and weekend traffic congestion are down.
  • Not only are people not going to work but they seem to be listening to the Stay at Home guidelines and not driving for personal reasons. This was indicated by a significant decrease in traffic congestion in the evenings and on weekends.
  • There seems to be a drop in the number of people driving the Sea to Sky highway and visiting Squamish and Whistler. People are staying closer to home. Though, I acknowledge that using this dataset to make this claim is a bit of a stretch. Instead, collecting data between Squamish and Vancouver along the Sea to Sky highway alone (i.e. no city traffic) would reveal more.

All data used in this analysis is freely available on GitHub.

--

--