Finding your way around local public transit just got a lot easier.
You have an appointment in town somewhere, and you've just discovered from "Stay Out of Traffic Jams" [Hack #30] that it's definitely not worth driving this morning. You fire up your local public transit authority's web site, download their sketchy schematic map of the subway or bus system, and then discover to your chagrin that the map gives you no idea of which stop on which route is actually closest to your destination. Does this sound familiar? If the Google Maps hackers get their way, your experience will soon be a thing of the past.
As of this writing, Google Mapsenhanced public transportation maps are only available for a few cities in North America. Here's a rundown of what's available.
The first stop on our tour of Google Maps transit mashups is David Pritchard's Vancouver Transit Map for the public transportation system in Vancouver, BC. The Vancouver Transit Map lives on the Web at http://www.david.enigmati.ca/maps/transit.html. As you can see from Figure 4-9, the site uses Google Maps polylines to depict the major transit routes in town.
Figure 4-9. Public transit in Vancouver, BC
The transit line stops are depicted with circles, which open an info window showing the name of the stop and the intersecting bus lines. The text labels showing the names of major stops at different zoom levels are also clickable, and make for a nice touch in terms of the map's readability.
Matt King's Boston Subway Station Map at http://www.thrall.net/maps/mbta.html takes something of a similar approach, as you can see in Figure 4-10. Instead of the station labels on the map, along the top we get a row of color-coded drop-down boxes, organized by subway line, to help find individual stations.
Clicking any of the station markers opens an info window with the station name, street address, and navigational links. The "To here" and "From here" driving directions links are pretty self-explanatory, but the "Zoom in" and "Zoom out" navigation links are special. If the map is zoomed out, clicking "Zoom in" will cause the map to iteratively zoom in, one level at a time, on a delay interval, so that you can situate the subway stop in the larger geographic context of Boston. Once zoomed in, the "Zoom out" link performs the reverse operation. This progressive zoom-in/zoom-out is referred to by digital cartographers as ballistic zoom.
Figure 4-10. Subway stations in Boston, MA
Chris Smoak's Seattle Bus Monster site at http://www.busmonster.com/ is probably the most feature-rich of the Google Maps transit mashups we've seen so far. The site has three basic sections: Bus Stops, Routes, and Traffic Conditions. In the Bus Stops section, you type in an address, intersection, or landmark to find bus stops near that location, as shown in Figure 4-11. Clicking on an individual bus stop shows, almost miraculously, the expected arrival times for the next few buses on that route (if available).
In the Routes section, you can type in route numbers to view routes, stops along those routes, and current bus locations. The Traffic Conditions section shows hundreds of traffic cams in the area.
Perhaps the most remarkable feature of this site is that, in the Routes view, you can click on a particular bus stop and set an "alarm" for that scheduled bus arrival. Once you've created the alarm, you can click on the alarm icon in the info window, and you'll be prompted for a number of minutes lead time and an email address to send the alarm to. If your cellular provider relays email to your phone as text messagesand most doyou can enter the email address of your phone and be notified in real time when the bus is on its way!
Figure 4-11. Public buses in Seattle, WA
The Bus Monster site makes heavy use of the XMaps extension to the Google Maps API [Hack #64].
4.4.4. New York City
Naturally, the Big Apple, with one of the most extensive public transportation systems in North America, wouldn't be without at least one Google Maps transit mashup. Will James is responsible for the NYC Subway Map at http://www.onnyturf.com/subwaymap.php. The basic functionality of this map is similar to that of other mapsclick on a station, and an info window pops up, with the station name and one or more icons provide links to the MTA's web page for the relevant subway lines that stop at that station, as shown in Figure 4-12.
What's exceptional about the NYC Subway Map is that, unlike the other transit mashups, it doesn't use the Google Maps GPolyLine class to depict the subway lines. Instead, Will decided that the variety of colors in the standard MTA subway map meshed poorly with the default color scheme of Google Maps, and that the map would look betterand be more read-ableif he made his own background tiles. An additional map type control marked "SUBWAY" at the top-right corner of the map, allows you to switch back and forth between that and the traditional Google Maps backgrounds. Will's process for generating custom Google Maps background tiles is described in Chapter 7.
Adrian Holovaty's Chicago Transit Authority map page (http://www.holovaty.com/blog/archive/2005/04/19/0216 deserves special mention for being one of the earlier Google Maps mashups. Instead of providing an integrated interface using the Google Maps API, the CTA map relied on a Firefox extension to integrate Adrian's custom map tiles into Google Maps on the client side at the right time and place (namely, zoom level 5 over Chicago). Unfortunately, as of this writing, the extension no longer works, probably due to subsequent changes to the Google Maps interface.
Figure 4-12. Subway stations in New York City
4.4.6. Where's My City?
Don't live in any of these places? Can't find a Google Maps transit mashup for your hometown? Perhaps that's a sign that you should finish this book and then go out and make your own!