August 22nd, 2011 | Published in Google Code
By Vladimir Rychev, Software Engineer
Cross-posted with the Google LatLong Blog
In June, we launched Live Transit Updates, a feature that adds realtime public transport information to Google Maps and Google Maps for mobile. This feature is powered by the GTFS-realtime feed format. Today we’re making the specification of this format public on Google Code. GTFS-realtime allows public transport agencies to provide realtime updates about their fleets. If you’re developing a trip planner or similar application, you can process these feeds and keep your users up-to-date with realtime information.
GTFS-realtime is an extension to GTFS, the General Transit Feed Specification, published by Google in 2006. Nowadays, GTFS is a very commonly used feed format that public transport agencies use to (publicly) provide their transport information. As opposed to GTFS feeds, GTFS-realtime feeds contain very dynamic information. This means that they have to be updated frequently and applications that use them have to fetch them frequently as well. This requires a significant infrastructure from the transport agency’s side, but it results in a continuously updated description of the current situation.
The specification currently includes three types of realtime updates: Trip Updates, Service Alerts and Vehicle Position updates. Each type of update has to be provided in a separate feed, and can be used independently.
Trip Updates are a way to present changes in the timetable. When a trip is delayed, canceled, added, or re-routed, a Trip Update can be used to provide this information in real time. Service Alerts can be used to notify passengers about special circumstances in the public transport network. In a Vehicle Position update, an agency provides the current location of an individual vehicle.
To encode realtime updates, Protocol Buffers are used. Protocol Buffer data structures can be processed very efficiently, resulting in low processing times compared to other popular data encapsulation standards. Because Protocol Buffers are compressed, they also use communication bandwidth efficiently. Protocol Buffers are very easy to work with, and there are libraries available for many programming languages.
The specification was designed through a partnership of the initial Live Transit Updates partner agencies, a number of transit developers, and Google. It has been published under the Creative Commons Attribution 3.0 license, the same license used for GTFS. You can discuss the specification and propose changes in the discussion group.
MBTA (Boston) and TriMet (Portland) have already made their GTFS-realtime feeds available for use in your applications. BART (SF Bay Area) and MTS (San Diego) have committed to making their feeds available in the future as well. We hope that many more agencies will follow!
Vladimir Rychev is a Software Engineer on the Google Transit team in Zürich. Before moving to Switzerland Vladimir taught kids at the Moscow 57th school, traveled the world from Cuba to Kazakhstan and entered programming contests from ICPC to topcoder.
Posted by Scott Knaster, Editor