ArticleslgStudy

computer science

GTFS

GTFS is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand GTFS rather than just read about it. In short: GTFS, or the General Transit Feed Specification, is a general transit feed specification which defines a common data format for public transportation schedules and associated geographic information. GTFS contains only static or scheduled information about public transport services, and is sometimes known as GTFS Static or GTFS Schedule to distinguish it from the GTFS Realtime extension, which defines how information…

GTFS — main illustration
GTFS — illustration

Key takeaways

  • GTFS belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect GTFS to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of GTFS from memory before moving on to harder problems.

Reference excerpt

GTFS, or the General Transit Feed Specification, is a general transit feed specification which defines a common data format for public transportation schedules and associated geographic information. GTFS contains only static or scheduled information about public transport services, and is sometimes known as GTFS Static or GTFS Schedule to distinguish it from the GTFS Realtime extension, which defines how information on the realtime status of services can be shared.

History What was to become GTFS started out as a side project of Google employee Chris Harrelson in 2005, who "monkeyed around with ways to incorporate transit data into Google Maps when he heard from Tim and Bibiana McHugh, married IT managers at TriMet, the transit agency for Portland, Oregon". McHugh is cited with being frustrated about finding transit directions in unfamiliar cities, while popular mapping services were already offering easy-to-use driving directions at the time. Bibiana and Tim McHugh eventually got into contact with Google and provided the company with CSV exports of TriMet's schedule data. In December 2005, Portland became the first city to be featured in the first version of Google's "Transit Trip Planner". In September 2006, five more US cities were added to the Google Transit Trip Planner, and the data format released as the Google Transit Feed Specification. In the United States, there had not been any standard for public transit timetables prior to the advent of GTFS, not even a de facto standard. According to long-time BART website manager Timothy Moore, before the advent of GTFS, BART had to provide different data consumers with different formats, making a standardized transit format very desirable. The publicly and freely available format specification, as well as the availability of GTFS schedules, quickly made developers base their transit-related software on the format. This resulted in "hundreds of useful and popular transit applications" as well as catalogues listing available GTFS feeds. Due to the common data format those applications adhere to, solutions do not need to be custom-tailored to one transit operator, but can easily be extended to any region where a GTFS feed is available. Due to the wide use of the format, the "Google" part of the original name was seen as a misnomer "that makes some potential users shy away from adopting GTFS". As a consequence, it was proposed to change the name of the specification to General Transit Feed Specification in 2009.

Applications

Journey planning GTFS is typically used to supply data on public transit for use in multi-modal journey planner applications. In most cases, GTFS is combined with a detailed representation of the street/pedestrian network to allow routing to take place from point to point rather than just between stops. This data is often extended using GTFS-Realtime to factor delays, cancellations, and modified trips into realtime journey planning queries. OpenTripPlanner is open-source software that can do journey planning with a combination of GTFS and OpenStreetMap data. Other general purpose applications exist such as the ArcMap Network Analyst extension which can incorporate GTFS for transit routing. GTFS was originally designed for use in Google Transit, an online multi-modal journey planning application.

Accessibility research GTFS is often used in research on transit accessibility where it is typically used to estimate travel times by transit from one point to many other points at different times of day. Studies however have called such applications into question due to their reliance on schedules alone without accounting for reliability issues and regular schedule non-adherence.

Comparing service levels GTFS has been used to measure changes in accessibility due to changes in transit service provision, either actual or proposed. Analysis of changes in service over time can be accomplished by simply comparing published GTFS data for the same agency from different time periods. For comparison of existing service with proposed infrastructure or service changes, a future GTFS must often be constructed by hand based on proposed service characteristics.

Feed registries Public GTFS feeds have been aggregated in a variety of feed registries:

Mobility Database (2023–present) builds on TransitFeeds (2013–2024) which maintained a directory of GTFS and GTFS Realtime feeds and an interactive website for browsing feed contents. Transitland (2014–present) maintains a directory of GTFS and GTFS Realtime feeds in 55+ countries and provides both an interactive website and APIs for querying feed contents. Transitland was originally created by Mapzen and is now maintained by Interline Technologies. GTFS Data Exchange Archived 25 April 2013 at the Wayback Machine (2008–2016) allowed public transit agencies of all sizes to upload copies of their GTFS feeds. The website is no longer active.

Structure

A GTFS feed is a collection of at least six and up to 20 or more CSV files (with extension .txt) contained within a .zip file. Preferred character encoding is UTF-8. Together, the related CSV tables describe a transit system's scheduled operations as visible to riders. The specification is designed to be sufficient to provide trip planning functionality, but is also useful for other applications such as analysis of service levels and some general performance measures. In contrast to European transit industry exchange standards such as Transmodel or VDV-45X, GTFS only includes scheduled operations that are meant to be distributed to riders. It is also limited to scheduled information and does not include real-time information. However, real-time information can be related to GTFS schedules according to the related GTFS Realtime specification. Following are descriptions of the tables required for a valid GTFS data feed. Each table is literally a text CSV file whose filename is the name of the table, suffixed by '.txt'. So for the 'agency' table below, a CSV file called 'agency.txt' would be included in a valid GTFS feed.

Mandatory tables

agency The agency table provides information about the transit agency as such, including name, website and contact information. Required fields:

agency_name agency_url agency_timezone

routes The routes table identifies distinct routes. This is to be distinguished from distinct routings (or paths), several of which may belong to a single route. Required fields:

… excerpt ends here. Continue reading the full article.

Illustrations

GTFS illustration
GTFS: Screenshot showing OpenTripPlanner with route from GTFS data highlighted.
Screenshot showing OpenTripPlanner with route from GTFS data highlighted.
GTFS: GTFS-based reachability analysis via Mapnificent
GTFS-based reachability analysis via Mapnificent
GTFS: Class diagram of GTFS
Class diagram of GTFS

Worked examples

Example 1 — a first encounter with GTFS

Start with the simplest possible case. Write down what GTFS claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to GTFS before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about GTFS ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of GTFS

In research
GTFS appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses GTFS in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
GTFS is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer file formats, Open data, Public transport information systems, so understanding it makes those chapters shorter.
In everyday life
Look for GTFS outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “GTFS” →

How to study GTFS in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what GTFS means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain GTFS out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is GTFS in simple terms?

GTFS, or the General Transit Feed Specification, is a general transit feed specification which defines a common data format for public transportation schedules and associated geographic information. GTFS contains only static or scheduled information about public transport services, and is sometimes…

Why does GTFS matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study GTFS?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on GTFS.

Tags

  • Computer file formats
  • Open data
  • Public transport information systems
  • Scheduling (transportation)
  • Web syndication formats

Keep exploring