{"id":135,"date":"2005-07-02T17:54:00","date_gmt":"2005-07-03T01:54:00","guid":{"rendered":"http:\/\/crazedmonkey.com\/blog\/uncategorised\/ttcgooglemap.html"},"modified":"2006-10-22T23:03:16","modified_gmt":"2006-10-23T03:03:16","slug":"ttcgooglemap","status":"publish","type":"post","link":"http:\/\/crazedmonkey.com\/blog\/programming\/ttcgooglemap.html","title":{"rendered":"TTC subway map using Google Maps"},"content":{"rendered":"<p>I spent a little time this weekend playing with the <a href=\"http:\/\/www.google.com\/apis\/maps\/\">Google Maps API<\/a> and creating <a href=\"http:\/\/crazedmonkey.com\/ttcgooglemap\/\">an overlay of the TTC subway<\/a>. 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.<\/p>\n<p>Translating the subway station addresses into <a href=\"http:\/\/www.google.com\/apis\/maps\/documentation\/#GPoint_code_\"><code>GPoint<\/code><\/a> 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:<\/p>\n<pre><code>#!\/bin\/sh\nwget -q -O- http:\/\/maps.google.com?q=\\\\\n`echo $1 | tr \" \" \"+\"` | sed -n -e \\\\\n\"s\/.*&lt;point lat=\\\"\\\\([^\\\"]*\\\\)\\\" lng=\\\"\\\\([^\\\"]*\\\\)\\\".*\/new GPoint( \\\\2, \\\\1 )\/p\"<\/code><\/pre>\n<p>If I have one beef with the API, it&#8217;s with the <a href=\"http:\/\/www.google.com\/apis\/maps\/documentation\/#GIcon_code_\"><code>GIcon<\/code> class<\/a> 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.<\/p>\n<p> <ins datetime=\"20050716T1756EST5EDT\"> <\/p>\n<p><strong>Update:<\/strong> I have since added <a href=\"http:\/\/crazedmonkey.com\/blog\/computers\/programming\/ttcgooglemap-station-list.html\" title=\"TTC subway map using Google Maps, now easier to use\">a clickable list of subway stations<\/a> to the map.<\/p>\n<p><\/ins> <ins datetime=\"20050730T1400EST5EDT\"> <\/p>\n<p><strong>Update:<\/strong> Now <a href=\"http:\/\/crazedmonkey.com\/blog\/computers\/programming\/ttcgooglemap-for-all.html\" title=\"TTC Google Maps for all!\">any Google Map can contain the TTC subway map<\/a>.<\/p>\n<p><\/ins><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I spent a little time this weekend playing with the <a href=\"http:\/\/www.google.com\/apis\/maps\/\">Google Maps API<\/a> and creating <a href=\"http:\/\/crazedmonkey.com\/ttcgooglemap\/\">an overlay of the TTC subway<\/a>. 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&nbsp;&hellip;&nbsp;<a class=\"read_more\" href=\"http:\/\/crazedmonkey.com\/blog\/programming\/ttcgooglemap.html\" rel=\"bookmark\" title=\"Continue reading &ldquo;TTC subway map using Google Maps&rdquo;\"><span>Read more<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[2,26,875],"tags":[],"_links":{"self":[{"href":"http:\/\/crazedmonkey.com\/blog\/wp-json\/wp\/v2\/posts\/135"}],"collection":[{"href":"http:\/\/crazedmonkey.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/crazedmonkey.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/crazedmonkey.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/crazedmonkey.com\/blog\/wp-json\/wp\/v2\/comments?post=135"}],"version-history":[{"count":0,"href":"http:\/\/crazedmonkey.com\/blog\/wp-json\/wp\/v2\/posts\/135\/revisions"}],"wp:attachment":[{"href":"http:\/\/crazedmonkey.com\/blog\/wp-json\/wp\/v2\/media?parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/crazedmonkey.com\/blog\/wp-json\/wp\/v2\/categories?post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/crazedmonkey.com\/blog\/wp-json\/wp\/v2\/tags?post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}