Sunday, April 7, 2013

The Shape of My Commute



I've been commuting from the east bay to the peninsula for many years, to many different locations. I realized that I've never had any reliable data about the best and worst times to leave home or work.

I decided to use the estimated times that Google Maps provides to try to get a clearer picture. I first wrote code to use the Google Distance Matrix API to get estimated driving times. I got that working, but got a nice (but useless) flat line when graphing estimated commute duration by departure time. I now assume that the API provides the first number shown on the web page, not the second:

I then re-wrote my code to use Selenium to grab the data off the web page. Those numbers made more sense. I don't have many days of data yet. I'm assuming that, as I get more data and average it in, the bumps in my graph will smooth out a bit.

If you want to do this, my code is available from Github. You will need to download a few Java jar files to get it to run.

No comments: