Routes describe how agencies communicate their services to riders. Define routes in the routes.txt
file, which has the following structure:
Required fields
route_id,route_short_name,route_long_name,route_type
Optional fields
agency_id,route_desc,route_url,route_color,route_text_color
See file routes.txt for a description of the fields it contains.
The following example shows a simple routes.txt
file:
route_id,route_short_name,route_long_name,route_desc,route_type
17,A,Mission,"The ""A"" route travels from lower Mission to Downtown.",3
Route modeling
Organize routes.txt
entries in the same way that you communicate physical routes or lines to your riders. For example, group your timetables by route in routes.txt
, just as you would when presenting them on a website or in a printed booklet. The structure of your routes.txt
file must correspond directly to the timetable routes.
Follow these best practices when modeling routes:
route_color
: Theroute_color
androute_text_color
fields help users to identify a route. NOTE: The route color must be a six-character hexadecimal number, for example, 00FFFF. If no color is specified, the default route color is white (FFFFFF).Your selected route colors must be consistent with the colors in schedules, maps, signage, or labels on vehicles.
Use contrasting colors for the
route_color
androute_text_color
fields because the system uses these fields as text and background colors when displaying route names.If your agency does not use colors, leave these fields empty.
route_url
: Set theroute_url
to a webpage that provides information about the route.route_desc
: Enter a route description in theroute_desc
field.
Route names
Routes in your GTFS feed must use the same naming as the physical routes or lines communicated by your agency. City networks often use numbers, letters, or colors to distinguish different lines and routes. However, intercity trains, long distance buses, or ferry services are often identified by their type or by the name of the operator; in this case, use those identifiers as route names. Do not include words such as "line" or "route" in route names.
Route_short_name
and Route_long_name
fields
The value of the route_short_name
field must be a number or short identifier. Don’t duplicate this value in the route_long_name
field, since they are generally shown next to each other. If the route does not have both a route_long_name
and a route_short_name
, leave one field empty.
We recommend that you display the route_short_name
. If the route_long_name
contains the name used for communication, then leave route_short_name
empty.
Routes vs Trips
Keep in mind that a Trip occurs at a specific time and a Route is time-independent. Do not break a physical route into multiple entries in routes.txt
to represent different route variations such as direction of travel. Instead, use trips.txt features to model those variations (as shown in the Example routes below). Multiple entries in routes.txt
with the same route_short_name
or route_long_name
show that routes have been unnecessarily subdivided.
Example routes
The following sections contain example route models. The first correctly models the routes with trip variations.
Example 1 - Correct
routes.txt
route_id,route_short_name,route_long_name,route_type
R10,10,Airport - Downtown,3
R20,20,University - Downtown,3
File
trips.txt
route_id,service_id,trip_id,trip_headsign,direction_id
R10,WD,T-10-1,Airport,0
R10,WE,T-10-2,Downtown,1
R20,WD,T-20-1,University,0
R20,WE,T20-2,Downtown,1
Example 2 - Incorrect
File routes.txt
route_id,route_short_name,route_long_name,route_type
R10-in,10,To Downtown,3
R10-out,10,To Airport,3
R20-in,20,To Downtown,3
R20-out,20,To University,3
Route modeling scenarios
The following sections contain detailed modeling scenarios.
Scenario 1
Bus line 1 operates between stops A - B - C - D - E - F. Some trips only operate between A and D, some trips skip B, C, and E. This route is modeled as one route “1” in the feed, including trips from A to F.
File stops.txt
stop_id,stop_name,stop_lat,stop_lon
stopA,Stop A,-21.213049,-159.825975
stopB,Stop B,-21.227892,-159.828051
stopC,Stop C,-21.252230,-159.821118
stopD,Stop D,-21.260588,-159.800071
stopE,Stop E,-21.271595,-159.757365
stopF,Stop F,-21.269228,-159.739851
File routes.txt
route_id,route_short_name,route_long_name,route_type
BusLine1,1,,3
File trips.txt
route_id,service_id,trip_id
BusLine1,0,tripABCDEF
BusLine1,0,tripABCD
BusLine1,0,tripADF
File stop_times.txt
trip_id,arrival_time,departure_time,stop_id,stop_sequence
tripABCDEF,06:00:00,06:00:00,stopA,1
tripABCDEF,06:10:00,06:12:00,stopB,2
tripABCDEF,06:20:00,06:22:00,stopC,3
tripABCDEF,06:30:00,06:32:00,stopD,4
tripABCDEF,06:40:00,06:42:00,stopE,5
tripABCDEF,06:50:00,06:50:00,stopF,6
tripABCD,08:00:00,08:00:00,stopA,1
tripABCD,08:10:00,08:12:00,stopB,2
tripABCD,08:20:00,08:22:00,stopC,3
tripABCD,08:30:00,08:30:00,stopD,4
tripADF,10:00:00,10:00:00,stopA,1
tripADF,10:30:00,10:32:00,stopD,2
tripADF,10:50:00,10:50:00,stopF,3
Scenario 2
Using the same setup as the previous scenario, however, the trips that skip B, C, and E are communicated to users in schedules as a separate line (1 Express). This scenario requires that you model maps and signage as a separate route (1 Express) in the feed.
File stops.txt
stop_id,stop_name,stop_lat,stop_lon
stopA,Stop A,-21.213049,-159.825975
stopB,Stop B,-21.227892,-159.828051
stopC,Stop C,-21.252230,-159.821118
stopD,Stop D,-21.260588,-159.800071
stopE,Stop E,-21.271595,-159.757365
stopF,Stop F,-21.269228,-159.739851
File routes.txt
route_id,route_short_name,route_long_name,route_type
BusLine1,1,,3
BusLine1Express,1 Express,,3
File trips.txt
route_id,service_id,trip_id
BusLine1,0,tripABCDEF
BusLine1,0,tripABCD
BusLine1Express,0,tripADF
File stop_times.txt
trip_id,arrival_time,departure_time,stop_id,stop_sequence
tripABCDEF,06:00:00,06:00:00,stopA,1
tripABCDEF,06:10:00,06:12:00,stopB,2
tripABCDEF,06:20:00,06:22:00,stopC,3
tripABCDEF,06:30:00,06:32:00,stopD,4
tripABCDEF,06:40:00,06:42:00,stopE,5
tripABCDEF,06:50:00,06:50:00,stopF,6
tripABCD,08:00:00,08:00:00,stopA,1
tripABCD,08:10:00,08:12:00,stopB,2
tripABCD,08:20:00,08:22:00,stopC,3
tripABCD,08:30:00,08:30:00,stopD,4
tripADF,10:00:00,10:00:00,stopA,1
tripADF,10:10:00,10:12:00,stopD,2
tripADF,10:20:00,10:20:00,stopF,3
Route naming
The following are examples of route naming:
-
The Zürich tram network uses numbers and colors to identify the different lines.
-
Zürich, Albisgütli
[route_short_name
: “13”,route_long_name
: “”,trip_headsign
: “Zürich, Albisgütli,route_color
: "FFCC00",route_text_color
: "000000"] -
Zürich, Zoo
[route_short_name
: “6”,route_long_name
: “”,trip_headsign
: “Zürich, Zoo”,route_color
: "CA7D3C",route_text_color
: "FFFFFF"]
-
-
National rail services in Great Britain are communicated by the name of the operator.
-
London Waterloo
[route_short_name
: “South West Trains”,route_long_name
: “”,trip_headsign
: “London Waterloo”] -
Brighton
[route_short_name
: “Southern”,route_long_name
: “”,trip_headsign
: “Brighton”]
-
-
National rail services in Europe are communicated by the type of train (specified in this example with field
route_short_name
).-
ICE 801 Berlin Südkreuz
[route_short_name
: “ICE”,route_long_name
: “”,trip_headsign
: “Berlin Südkreuz”,trip_short_name
: 801] -
Interlaken Ost
[route_short_name
: “IC”,route_long_name
: “”,trip_headsign
: “Interlaken Ost”]
-
-
Long distance buses in Argentina are communicated by the name of the operator.
-
Cordoba
[route_short_name
: “Mercobus”,route_long_name
: “”,trip_headsign
: “Cordoba”] -
Rafael Castillo
[route_short_name
: “Rutatlantica”,route_long_name
: “”,trip_headsign
: “Rafael Castillo”]
-