Ian Stevens' weblog

TTC subway map using Google Maps

I spent a little time this weekend playing with the Google Maps API and creating an overlay of the TTC subway. Not surprisingly, creating the station markers and route lines was easy. The most difficult part, however, was obtaining a list of subway stations and their addresses in a text format for easy extraction.

Translating the subway station addresses into GPoint objects was a little difficult given that there appears to be no free geocoding service for Canadian addresses. However, Google Maps can work as a geocoder, albeit a somewhat slow one, sometimes taking several seconds to produce a result. If you have access to a Unix command-line, you can make use of the following script:

If I have one beef with the API, it’s with the GIcon class and the requirement to set the icon shadow, the icon and shadow sizes and the anchor point. A shadow should not be required and image sizes can be inferred. However, the icon will not display if any of these properties are not set.

Well spotted on the exclusion of St. George and Spadina on the Yonge-University line, Chad. I have since fixed the map. The page where I was able to find a relatively easily parsable address list seems to have disappeared. However, the Javascript code which creates the TTC Google map contains all the addresses.

[...] About a year ago I played around with the Google Maps API and created a map containing the TTC subway system. It wasn’t intended to be all that useful as the TTC’s own map contains much more information. Still, that didn’t stop my map from rising to the top of the Google rankings for TTC-related searches, resulting in hundreds of visits. A few people sent me emails and comments thanking me for making the map, and it even got a mention in the print version of the June 2006 issue of HUB. I didn’t see much reason for the fuss as the map could have been so much better. [...]

I was looking at your java script referenced above and I noticed a slight problem. CM_rtLinePoints has six points, but CM_rtLineHtml has only five labels. It seems Kennedy at 2455 Eglinton Ave. East is not present. Is there a reason?

I probably didn’t include Kennedy in the HTML for the RT line because it exists in the HTML for the Bloor-Danforth line, and I didn’t want to create duplicate markers. It’s in the points for the RT line probably because of an oversight.

(please delete my previous post, it was for a wrong article)
Nice stuff! We need something similar in Montreal, our STM morons still sitting on their ass with
PDF files too..
Check out my map: http://mtlmap.com – just started, only subway for now, pretty simple.
BTW, how long it took you to draw this image?!!! Must be weeks and weeksâ€¦ :)

hax!
This is pretty cool stuff, man. Maybe TTC will order you another custom map. This time for the busdrivers. With all the Tim Hortons locations on it, so these a$$hole$ know where to stop by on the route. =)
(You know how annoying this is when you’re in a hurry and they do it? lol)

Hi, Thanks for the map. I must suggest that the area name list be unicoloured and tighter margins, allowing the map to fill a greater field with mapquest-like appearance. This shoud be linked on the TTC homepage.

Nice work.
One small improvement, if you have time:
Could you print the complete street address of the stop in the balloons, including the Postal Code?
If I paste the existing partial address you display into a GoogleMaps ‘get directions to’ pane, I get a lot of potential choices for this destination but I don’t know which one is correct.