Updated GTFS-Fares v2 for the SF Bay Area



April 20, 2023: The GTFS-Fares v2 extension originally named fare_containers.txt has been renamed to fare_media.txt, as part its recent adoption in the GTFS specification.

During a transition period, the Regional GTFS Feed included both fare_containers.txt and fare_media.txt files (and all associated columns for both approaches). Now the Regional GTFS Feed only includes the fare_media.txt file.

The reference table below has been updated to reflect this change.

In 2020, Interline and the Metropolitan Transportation Commission released a beta version of fares and transfer discounts for eight SF Bay Area transit agencies. Since then, we’ve been working together to improve data coverage and its schema. As of this August, the Regional GTFS Feed now includes fares and transfer discounts for over 30 Bay Area transit agencies. The updated dataset uses the adopted GTFS-Fares v2 “base implementation,” as well a few proposed additions to the GTFS-Fares v2 data schema. This data is now available for use, and our team is updating it on an ongoing basis.

In this blog post we’ll cover:

GTFS-Fares v2 in action

If you have an Apple iPhone running iOS 16, you can see the estimated costs of transit journeys. This data is sourced from the the Regional Feed.

screenshot of an iPhone showing a map of a transit journey from Oakland to San Francisco costing $4.40
screenshot of an iPhone showing a list of different transit options that range from $2.15 to $6.00
screenshot of an iPhone showing the itinerary of a transit journey with the first leg costing $2.25 in Clipper Card fare and the second leg costing $2.15 in Clipper Card fare

All of the above fares information is defined in the Regional GTFS Feed using the GTFS-Fares v2 specification. Here are extracts of the relevant GTFS files from the feeds for the itinerary displayed on the iPhone:

fare_products.txt
fare_product_idfare_product_nameamountcurrencyrider_category_idfare_media_id
AC:local:singleAC Transit local fare2.25USDadultclipper
BA:matrix:FTVL-EMBRgenerated2.15USDadultclipper
fare_media.txt Updated
fare_media_idfare_media_namefare_media_type
clipperClipper2
fare_leg_rules.txt
leg_group_idfrom_area_idto_area_idnetwork_idfare_product_id
ACAC:localAC:localACAC:local:single
BAFTVLEMBRBABA:matrix:FTVL-EMBR
stop_areas.txt
area_idstop_id
AC:local55227
AC:local55550
FTVLFTVL
EMBREMBR

Note that this data schema has changed since the examples in our first release blog post. This new schema was adopted as part of the GTFS-Fares v2 “base implementation,” which we will now discuss in more detail.

GTFS-Fares v2 base implementation and future additions to the specification

Since the original GTFS-Fares v2 proposal, many stakeholders in GTFS have provided additional input. In May, stakeholders voted to adopt the core of the refined GTFS-Fares v2 proposal as a “base implementation”.

The “base implementation” simplifies the organization of fare_leg_rules.txt, fare_transfer_rules.txt, and fare_products.txt. This is a breaking change, so consumers who implemented their GTFS processing software against the original proposal will need to update their tools.

To fully capture the complexity of Bay Area transit fares and transfer discounts requires additional data tables and fields that were included in the original proposal but not in the “base implementation.”

Here is an overview of all the GTFS-Fares v2 tables and columns/fields included in the Regional GTFS Feed:

GTFS file Spec version(s) Columns added for extensions Documentation
fare_products.txt "base" with additional columns for extensions
  • rider_category_id
See gtfs.org reference
fare_leg_rules.txt "base" with additional columns for extensions
  • transfer_only*
See gtfs.org reference
fare_transfer_rules.txt "base" with additional columns for extensions
  • filter_fare_product_id*
See gtfs.org reference
areas.txt "base" See gtfs.org reference
stop_areas.txt "base" See gtfs.org reference
fare_media.txt "base" as of March 14, 2023 Updated See gtfs.org reference
rider_categories.txt extension
  • rider_category_id
  • rider_category_name
  • min_age
  • max_age
  • eligibility_url
See proposal Google Doc
routes.txt extension
  • as_route
See proposal Google Doc

* fare_leg_rules.txt transfer_only and fare_transfer_rules.txt filter_fare_product_id are two fields proposed for describing partial credit on inter-agency transfers. Thanks to the Transit app team for proposing these additions to make some of the transfer discounts in the Regional GTFS Feed more explicit for consuming software to parse.

Interline and MTC will continue to produce these “extensions” to the “base” data schema, and we’ll continue to work with data consumers, MobilityData, and other stakeholders to finalize their adoption into the GTFS spec.

SF Bay Area transit agencies with GTFS-Fares v2 data

Interline and MTC now produce fares, intra-agency transfer discounts, and inter-agency transfer discounts for the following agencies:

511 operator codeOperator full name
3DTri Delta Transit
ACAC Transit (including transbay routes)
AFAngel Island Tiburon Ferry
AMCapitol Corridor
BABay Area Rapid Transit (BART)
CCCounty Connection
CEAltamont Corridor Express (ACE)
CMCommute.org Shuttles
CTCaltrain
DEDumbarton Express Consortium
EMEmery Go-Round
FSFairfield and Suisun Transit
GFGolden Gate Ferry
GGGolden Gate Transit
MAMarin Transit
MVMVgo Mountain View
PEPetaluma Transit
RVRio Vista Delta Breeze
SASonoma Marin Area Rail Transit
SBSan Francisco Bay Ferry
SCValley Transportation Authority (VTA)
SFSan Francisco Municipal Transportation Agency (SFMTA)
SISan Francisco International Airport (SFO)
SMSamTrans
SOSonoma County Transit
SRSanta Rosa CityBus
SSCity of South San Francisco
STSolTrans
TDTideline Water Taxi
UCUnion City Transit
VCVacaville City Coach
VNVINE Transit
WCWestern Contra Costa (WestCat)
WHLivermore Amador Valley Transit Authority (LAVTA)

Fares are included for Clipper Card, cash, and a wide variety of passes. (Clipper Card is the contact-less payment card and system operated by MTC and available on buses, trains, and ferries throughout the Bay Area.) Transfer discounts between routes operated by the same agency (intra-agency transfers) are included for all methods of payment. Transfer discounts between routes operated by different agencies (inter-agency transfers) are only included for Clipper Card.

Our team is updating these fares and transfer discounts on a monthly basis.

Using GTFS-Fares v2 data for the Bay Area

Download the daily Regional Feed like so:

  1. Sign up for a 511 Open Data API token
  2. Download from http://api.511.org/transit/datafeeds?api_key=[your_key]&operator_id=RG

We welcome questions sent to the 511SFBayDeveloperResources mailing list.

Acknowledgements

Credit and many thanks to project team members including Ian Rees (Interline), Nome Dickerson (Garnet Consulting), Nisar Kapeel and Kapeel Daryani (MTC), and our partners at Bay Area transit agencies.

Originally posted to the Interline blog on October 4, 2022.

Most recently updated on April 20, 2023.

Written by: