Composed of fare_attributes.txt and fare_rules.txt, Fares v1 has historically been the official method for describing fare information in GTFS. However the two files are limited in the breadth of factors they can efficiently describe, and are ambiguous to implement. Fares v2 is an extension project under active development, and it aims to address the limitations of Fares v1.
Define an agency’s fare rules¶
A trip on the Toronto Transit Commission’s subway network costs $3.20 CAD if riders pay using the PRESTO card. Riders can also transfer to other subway, streetcar, or bus routes operated by the TTC within a two-hour window.
This service can be represented using the files fare_attributes.txt, fare_rules.txt, and transfers.txt. The first file, fare_attributes.txt describes the agency’s fares, below is an example for the presto fare:
- The price of the fare is listed under price and
- Riders have to pay their fare at the station fare gates before boarding the subway. This is represented by
- The field transfers is left blank to represent unlimited transfers
- The field
transfer_durationcorresponds to the 2-hour transfer window (in seconds)
The second file, fare_rules.txt assigns fares to journeys through tying a fare to a route as well as an origin/destination on that route.
For that, two subway lines are defined below in routes.txt:
agency_id,route_id,route_type TTC,Line1,1 TTC,Line2,1
In this example, transfers at Bloor-Yonge station are modeled. For that, this station is modeled as two separate stops, the first is Bloor Station which is served by Line 1, and the second is Yonge station, which is served by Line 2. Both have
zone_id=ttc_subway_stations in order to group all subway stations in a single fare zone.
stop_id,stop_name,stop_lat,stop_lon,zone_id Bloor,Bloor Station,,43.670049,-79.385389,ttc_subway_stations Yonge,Yonge Station,,43.671049,-79.386789,ttc_subway_stations
In fare_rules.txt, the PRESTO fare is associated with both subway lines and stations using the following relationships:
fare_id=presto_fare, riders can travel between any two stations on Line 1 (
fare_id,route_id,origin_id,destination_id presto_fare,line1,ttc_subway_stations,ttc_subway_stations presto_fare,line2,ttc_subway_stations,ttc_subway_stations
The third file, transfers.txt defines transfer points between different routes. To model transfers at Bloor-Yonge station, two entries are required:
from_stop_id,to_stop_id,from_route_id,to_route_id,transfer_type Bloor,Yonge,line1,line2,0 Yonge,Bloor,line2,line1,0
- The first models transfers from Line 1 to Line 2 using
to_route_idfrom Bloor station to Yonge station
- The second models transfers from Line 2 to Line 1 using
to_route_idfrom Yonge station to Bloor station
- The value for
0since there are no specific requirements or considerations for transfers