This project has been on my back burner for quite a while. I first got the idea for this project because I figured it would be helpful with picking a place to rent since commute times to different locations are an important factor to most people. It is also a nice visual aid to see which parts of the city are served effectively by public transit and which parts need additional infrastructure.
I started off by defining four corners for the city. Then I created a simple grid of points. I also defined a rough coastline for the city by picking some points along the coast. This allowed me to drop all the grid points that are located in Lake Ontario. The grid points look something like the one below.
Of course, the density of these grids can change, but I think too many grid points don't improve the overall results too much and only make the process more time-consuming and costly.
I then used Google Maps Directions API with the points on this grid map to get a travel time for each of these points to a set destination. The departure time can be configured as well. During peak commute times the results might differ slightly because of the increased GO train frequency. Using the scipy
library, I was able to interpolate between these values and create a nice heat map. For added clarity, I decided to plot the location of the TTC subway stations and GO train stations.
Using the method explained above, I was able to get the results below (both for 8 AM departure times). They are somewhat informative and I hope are useful to others as well. For Union Station and UofT, the departure time was set as 8 AM on a Monday. For Midtown, the departure time was set as noon on a Monday. For the rest of the locations, the departure time was set as 6 PM on a Friday.
I plan to redo this visualization after the Eglinton Crosstown and Finch West LRT open. I am curious to see how much the heat maps change. I also want to redo it when the Ontario Line opens, whenever that may be.
You can find the code for this project on my GitHub. Feel free to use it for yourself or use it as a reference to recreate this project for other cities.
Feel free to contact me at aryan.abed[at]pm.me