10. Repeating Trips (frequencies.txt)

This file is optional in a GTFS feed.

In some cases a route may repeat a particular stopping pattern every few minutes (picture a subway line that runs every 5 minutes). Rather than including entries in trips.txt and stop_times.txt for every single occurrence, you can include the trip once then define rules for it to repeat for a period of time.

Having a trip repeat only works in the case where the timing between stops remains consistent for all stops. Using frequencies.txt, you use the relative times between stops alongside a calculated starting time for the trip in order to determine the specific stop times.

FieldRequired?Description
trip_idRequiredThe ID of the trip as it appears in trips.txt that is being repeated. A single trip can appear multiple times for different time ranges.
start_timeRequiredThe time at which a given trip starts repeating, in HH:MM:SS format.
end_timeRequiredThe time at which a given trip stops repeating, in HH:MM:SS format.
headway_secsRequiredThe time in seconds between departures from a given stop during the time range.
exact_timesOptionalWhether or not repeating trips should be exactly scheduled. See below for discussion.

Sample Data

The following sample data is taken from Société de transport de Montréal (STM) in Montreal (https://openmobilitydata.org/p/societe-de-transport-de-montreal).

trip_idstart_timeend_timeheadway_secs
13S_13S_F1_1_2_0.2652805:30:0007:25:30630
13S_13S_F1_1_6_0.3416707:25:3008:40:10560
13S_13S_F1_1_10_0.4250008:40:1012:19:00505
13S_13S_F1_1_7_0.5875012:19:0015:00:00460
13S_13S_F1_1_11_0.6687515:00:0018:23:00420
13S_13S_F1_1_5_0.7888918:23:0021:36:35505

Each of the trips listed here have corresponding entries in trips.txt and stop_times.txt (more on that shortly). This data can be interpreted as follows.

  • The first trip runs every 10m 30s from 5:30am until 7:25am.
  • The second trip runs every 9m 20s from 7:25am until 8:40am, and so on.

The following table shows some of the stop times for the first trip (departure_time is omitted here for brevity, since it is identical to arrival_time).

trip_idstop_idarrival_timestop_sequence
13S_13S_F1_1_2_0.265281806:22:001
13S_13S_F1_1_2_0.265281906:22:592
13S_13S_F1_1_2_0.265282006:24:003
13S_13S_F1_1_2_0.265282106:26:004

As this trip runs to the specified frequency, the specific times do not matter. Instead, the differences are used. For the above stop times, there is a 59 second gap between the first and second time, a 61 second gap between the second and third, and a 120 second gap between the third and fourth.

The stop times for the first frequency record (10.5 minutes apart) can be calculated as follows.

  • 05:30:00, 05:30:59, 05:32:00, 05:34:00
  • 05:40:30, 05:41:29, 05:42:30, 05:44:30
  • 05:51:00, 05:51:59, 05:53:00, 05:55:00
  • ...
  • 07:25:30, 07:26:29, 07:27:30, 07:29:30

Specifying Exact Times

In the file definition at the beginning of this chapter there is an optional field called exact_times. It may not be immediately clear what this field means, so to explain it better, consider the frequency definitions in the following table.

trip_idstart_timeend_timeheadway_secsexact_times
T109:00:0010:00:003000
T209:00:0010:00:003001

These two frequencies are the same, with only the exact_times value different. The first (T1) should be presented in a manner such as:

"Between 9 AM and 10 AM this trip departs every 5 minutes."

The second trip (T2) should be presented as follows:

"This trip departs at 9 AM, 9:05 AM, 9:10 AM, ..."

While ultimately the meaning is the same, this difference is used in order to allow agencies to represent their schedules more accurately. Often, schedules that convey to passengers that they will not have to wait more than five minutes do so without having to explicitly list every departure time.