Mass transit reduces traffic congestion and the pollution it generates. And it can lower stress levels and out-of-pocket costs for the people who use it. Many Web sites and mobile applications now help commuters, shoppers, and tourists in cities all over the world be virtuously selfish and take advantage of their transit options. This article shows you some of the slick technology that makes getting where you need to go by bus (or light rail, or the El, or the subway) as easy as a walk in the park. Better yet, you can incorporate some of this technology into your own applications to help make riders more savvy about their transit opportunities.
Interactive Web sites that provide maps and driving directions have been available for several years now. Gone are the days of asking fellow humans for tedious turn-by-turn driving directions; you just plug the start and end addresses into one of these sites, and the online engine does the rest. Google Maps is arguably the most versatile of the mapping sites. Within a few months of its release in February 2005, Web developers had reverse-engineered Google Maps and created mashups that pulled data in from other sites and displayed the results on a Google map. One cheeky hacker combined real-time traffic data from Yahoo! with the driving directions from Google. This led to the release of the formal Google Maps API in June 2005. The Google Maps product manager joked, "We are doing this because they were already doing it" (see Resources).
By releasing an official API, Google shifted the focus of the Web site in a subtle but revolutionary way. It was now less a finished painting than a canvas on which programmers could paint their own pictures. Mashups sprouted up almost overnight that showed where the cheapest gasoline could be found, where the police had speed traps, and all kinds of other information that helped drivers along their way.
This do-it-yourself spirit wasn't lost on several Google employees who preferred taking the bus over driving. In December 2005, the Google Transit Trip Planner was introduced. Being able to choose between driving directions or public transportation is a feature that lives on in Google Maps today — just look for the drop-down list next to the Get Directions button. (You can choose walking and biking directions, as well.)
Take a moment to play around with this feature. Choose two major attractions in your home town — shopping malls, sports arenas, and airports are typically good picks — and get public transit directions between them.
Google Maps allows you to be fairly liberal in what you provide for the starting and ending points. I typed
Flat Iron Crossing, Broomfield, CO (a big shopping mall) and
Coors Field, Denver, CO (the baseball stadium where the Colorado Rockies play) in the A and B fields, respectively. Both places show up near the top of the list of suggestions from my fuzzy search, and with a single click the pertinent information appears in the appropriate field. Without knowing the exact address of either location, I now have a route between the two, as shown in Figure 1:
Figure 1. Google Maps showing public transit directions
When you choose public transit in Google Maps, you need to provide one additional bit of criteria — the time you want to travel. Since buses and trains follow specific timetables, you need to make sure that you are in the right place at the right time. Click on Show Options to reveal the Depart at and Arrive by fields, and choose either the time you'd like to leave or the time you'd like to arrive. Google Maps will adjust the suggested route accordingly, as shown in Figure 2:
Figure 2. Adjust your travel time in Google Maps
After you're done playing around with shopping malls and sports stadiums, try plugging in your home address and your work address. I found that I have a covered Park-and-Ride parking garage just 5 minutes from my house that offers free parking for the day with the purchase of bus fare. An express bus drops me off just a couple of blocks from my office. During rush hour, a bus comes by about every 10 minutes over a 2-hour time span. No stops, no transfers, no waiting, and I have a nearly door-to-door public transportation solution for getting to work every day. Thank you, Google Maps.
If the public transit option doesn't appear in Google Maps for your town, it's because your local transit authority isn't submitting its schedule to Google for inclusion. You can visit the Google Transit site, shown in Figure 3, to see if your town is on the list:
Figure 3. See if your transit authority is listed in Google Transit
To be included in Google Maps, the transit authority simply needs to provide its route data in the General Transit Feed Specification (GTFS) format, host it at a publicly available URL, and let Google know where to find it (see Resources). After that, Google will periodically download the files to ensure that the latest information is used to calculate routes.
The GTFS format is a related set of comma-separated value (CSV) files. For example, Figure 4 shows some sample data for the agency, stops, and routes:
Figure 4. A simple example of the GTFS format
A quick Web search for "rtd gtfs" points me to the page, shown in Figure 5, where the Denver transit authority (RTD) hosts its GTFS files. With the latitude/longitude points for each stop in hand, I now have the raw material for writing my own killer Google Maps mashup.
Figure 5. The Denver RTD GTFS Web page
If you want to be notified each time a transit authority updates its GTFS files, you can subscribe to an RSS feed, which you can optionally limit to a specific transit authority (see Resources). For example, I can see in the results shown in Figure 6 that RTD last updated its GTFS files about three weeks ago. Based on the history of the feed, it looks like RTD posts updates roughly once a quarter.
Figure 6. The GTFS Exchange Web site
The City-Go-Round Web site came online in December 2009 (see Resources). In addition to being an advocacy Web site for open transit data — as of this writing, 108 U.S. transit authorities offer open data while 677 do not — it is a great clearinghouse for transit-related Web sites and mobile applications. Figure 7 shows the City-Go-Round home page:
Figure 7. The City-Go-Round Web site
Click on the Agencies link at the top of the page. From there, you can choose your state and quickly see who provides public transportation in your area. You can also see whether or not they offer open data.
If you scroll to the bottom of the page, you'll see that the information can be exported as CSV or JSON. This data includes latitude/longitude points for each transit authority — more fodder for your own transit mashup. In Figure 8, for example, I'm finding Colorado's public transit options:
Figure 8. Finding the public transit options in Colorado
The About page at City-Go-Round offers an interesting visualization of open transit data, shown in Figure 9:
Figure 9. Visualizing open transit data
The size of each bubble in Figure 9 indicates the relative size of the transit authority. The darker bubbles are the agencies that offer open data.
If you click on the chart on the About page, it takes you to the ManyEyes data-visualization Web site on IBM alphaWorks. The ManyEyes application — implemented as an interactive Java™ applet — allows you to click on the various bubbles to get more information.
The Web sites I've mentioned so far are great resources for planning your trip while you are still sitting at home. But what about when you are standing on the street corner? Thankfully, there is a vibrant ecosystem of transit-related mobile phone applications. If you click on the Apps link at the top of City-Go-Round, you'll see mobile applications optimized for the iPhone, Android, BlackBerry, and more.
Denver, CO shortens the list to applications that will help me out in my area, as shown in Figure 10:
Figure 10. Mobile applications for Denver, Colorado
Some of the apps limit themselves to the RTD Light Rail. Others focus on specific destinations, such as bus routes to the airport. The ratings, reviews, and screen shots for each application help you determine which one best fits your needs.
An important consideration when evaluating mobile applications — or creating your own — is whether they store the data locally or pull the information over the air. This is especially important for subway riders who frequently lose cell service while underground. Using locally stored data tends to yield quicker response times, but the application should offer periodic updates to ensure that the user isn't looking at stale information.
For some inspiration for your own mobile transit apps (and so you don't reinvent the proverbial wheel), be sure to check out these free or low-cost standouts on City-Go-Round (see Resources for links to their pages).
UniBus is an iPhone application that offers support for all cities that, not surprisingly, also offer open data in the GTFS format. Since I travel a lot, having all of the transit information in a consistent format right in my pocket is a pretty appealing prospect. The data is stored locally, so I can research bus and train routes while I am still on the airplane. The app also provides Google Maps visualizations, estimated arrival times, the ability to save "favorite" routes, and much more.
Acrossair is an iPhone application that uses the built-in video camera to provide a real-time augmented reality view of where you are standing. Hold the phone up, look through it, and you'll see an overlay of which bus route you are on or where the nearest subway stop is. It doesn't work in every city, but if you are in New York, Washington, D.C., Chicago, or San Francisco and have a 3GS iPhone, you'll have your very own public transit-enabled heads-up display.
One Bus Away provides a real-time display of where all of the buses in a transit system are at any given moment. Only a handful of transit authorities now provide real-time bus location to the public; Seattle's King County Metro is one of them. Right now One Bus Away only works in Seattle and its environs, but as more transit authorities offer their real-time data, independent applications will inevitably sprout up.
As I was standing under an awning in the pouring rain on a recent trip to Redmond, I could look at my iPhone and see a Google Map that showed exactly how close my bus was to arriving. The tiny icons representing individual buses update their location on the map every 10 to 15 seconds. Once I was on the bus, I used the application to gauge how close I was to my final destination. I could see all of the scheduled stops along the way, so I knew exactly when to pull the "Stop Requested" cord. It was my first time on the bus, but I already felt like a seasoned pro.
Whether your intentions are altruistic or selfish (or both), you owe it to yourself to explore the public transit options available to you in your city. Familiar Web sites, like Google Maps, make it easy to get started, and advocacy sites like City-Go-Round give you the mobile tools you need to make it convenient. They can be indispensable resources when you begin designing your own transit applications.
For a higher-level perspective on the intersection between community planning and technology, you can explore The Open Planning Project (TOPP) (see Resources). A "technology-driven social enterprise," TOPP is one of the largest organizations in the world dedicated to producing open source software. Transportation reform is one of TOPP's major initiatives. For example, when Portland, Oregon's award-winning TriMet transit system wanted to overhaul its interactive system map and integrate it with its existing trip planner, TriMet partnered with TOPP to switch out proprietary components for open source alternatives. (Full disclosure: I served as a consultant on the project.) Another great TOPP project is Streetsblog — a news source, online community, and political mobilizer for individuals and organizations who want to to transform cities by reducing dependence on automobiles and improving conditions for cyclists, pedestrians, and transit riders (see Resources).
"Packing Pavement" (Jim Beamguard, Tampa Bay Online, July 1999): Cars, not transit systems, create urban congestion.
Google Maps: Find your way to the Google Maps site.
"Map Hacks on Crack" (Wired, July 2005): Read about the release of the Google Maps API.
GTFS: This page explains the types of files that comprise a GTFS transit feed and defines the fields used in those files.
GTFS Data Exchange: Transit districts can upload their GTFS data here. This is also where you can subscribe to an RSS feed to get GTFS data updates.
City-Go-Round: City-Go-Round helps people find transit applications and encourages public transit agencies to open their data to software developers.
Learn more about the three mobile apps described in this article:
The Open Planning Project: Find out how TOPPS helps build better tools for transit, including Portland's
TriMet, with open source software.
Streetsblog: Check out Streetsblog for New York, Los Angeles, San Francisco, and Washington, D.C.
bookstore: Browse for books on these and other technical topics.
- Get involved in the
My developerWorks community.
Scott Davis is an internationally recognized author, speaker, and software developer. He is the founder of ThirstyHead.com, a Groovy and Grails training company. His books include Groovy Recipes: Greasing the Wheels of Java, GIS for Web Developers: Adding Where to Your Application, The Google Maps API, and JBoss At Work. He writes two ongoing article series for IBM developerWorks: Mastering Grails and Practically Groovy.