Skip to content
Documentation

Routes

Last updated

Routes are routes.txt entities imported from GTFS, and include the same basic structure and fields, plus some additional metadata and derived information. A route is a collection of trips, where each trip represents scheduled service to stops on a given day and time.

Each route includes a representative geometry assembled from the shapes its trips use. In each direction, a shape is included if it carries more than 20% of that direction's trips, and the longest shape in each direction is always included. Shapes with a point at 0,0 or a segment longer than 1,000 km are left out.

Shapes from the feed's shapes.txt are preferred. When a route has none, Transitland uses shapes it generates from the stop-to-stop path of trips that lack a shape_id. The first line in the geometry is the shape used by the most trips. Full shapes are available when accessing individual trips.

Onestop ID values are automatically generated for every route from a geohash of the stops the route visits and the route's route_short_name (or route_long_name when there is no short name). Two very similar routes may generate the same Onestop ID value, in which case more than one route is returned when searching by Onestop ID.

Every route in Transitland has a route_type, stored as the value given in the feed. The allowable values are the basic route types from the GTFS specification and the extended route types.

transitland-lib maps each extended route type to the basic route type it is a kind of. The GraphQL and REST APIs return this as route_type_basic on routes, and as route_types_basic on agencies and operators. A route_type that is already basic, or that is not a known extended type, is returned unchanged.

Route type codes can be used to query the routes REST endpoint with the route_type and route_types query parameters, and the stops REST endpoint with the served_by_route_type query parameter. These filters match the stored route_type exactly: route_type=3 returns routes coded as 3, and does not include routes coded as 700 (Bus Service) or other extended bus types.

Basic route types

CodeNameDescription
0TramTram, streetcar, or light rail
1MetroSubway or metro
2RailIntercity or long-distance rail
3BusShort- and long-distance bus
4FerryShort- and long-distance boat service
5CablecarStreet-level rail cars pulled by a cable under the vehicle
6GondolaAerial lift or suspended cable car
7FunicularRail designed for steep inclines
11TrolleybusElectric bus powered by overhead wires
12MonorailRailway with a track of a single rail or beam

Extended route types

Extended types with no close basic equivalent, such as air, taxi, and self-drive services, map to Bus (3).

CodeNameBasic type
100Railway ServiceRail (2)
101High Speed Rail ServiceRail (2)
102Long Distance TrainsRail (2)
103Inter Regional Rail ServiceRail (2)
104Car Transport Rail ServiceRail (2)
105Sleeper Rail ServiceRail (2)
106Regional Rail ServiceRail (2)
107Tourist Railway ServiceRail (2)
108Rail Shuttle (Within Complex)Rail (2)
109Suburban RailwayRail (2)
110Replacement Rail ServiceRail (2)
111Special Rail ServiceRail (2)
112Lorry Transport Rail ServiceRail (2)
113All Rail ServicesRail (2)
114Cross-Country Rail ServiceRail (2)
115Vehicle Transport Rail ServiceRail (2)
116Rack and Pinion RailwayRail (2)
117Additional Rail ServiceRail (2)
200Coach ServiceBus (3)
201International Coach ServiceBus (3)
202National Coach ServiceBus (3)
203Shuttle Coach ServiceBus (3)
204Regional Coach ServiceBus (3)
205Special Coach ServiceBus (3)
206Sightseeing Coach ServiceBus (3)
207Tourist Coach ServiceBus (3)
208Commuter Coach ServiceBus (3)
209All Coach ServicesBus (3)
300Suburban Railway ServiceRail (2)
400Urban Railway ServiceMetro (1)
401Metro ServiceMetro (1)
402Underground ServiceMetro (1)
403Urban Railway ServiceMetro (1)
404All Urban Railway ServicesMetro (1)
405MonorailMonorail (12)
700Bus ServiceBus (3)
701Regional Bus ServiceBus (3)
702Express Bus ServiceBus (3)
703Stopping Bus ServiceBus (3)
704Local Bus ServiceBus (3)
705Night Bus ServiceBus (3)
706Post Bus ServiceBus (3)
707Special Needs BusBus (3)
708Mobility Bus ServiceBus (3)
709Mobility Bus for Registered DisabledBus (3)
710Sightseeing BusBus (3)
711Shuttle BusBus (3)
712School BusBus (3)
713School and Public Service BusBus (3)
714Rail Replacement Bus ServiceBus (3)
715Demand and Response Bus ServiceBus (3)
716All Bus ServicesBus (3)
717Share Taxi ServiceBus (3)
800Trolleybus ServiceTrolleybus (11)
900Tram ServiceTram (0)
901City Tram ServiceTram (0)
902Local Tram ServiceTram (0)
903Regional Tram ServiceTram (0)
904Sightseeing Tram ServiceTram (0)
905Shuttle Tram ServiceTram (0)
906All Tram ServicesTram (0)
907Cable TramTram (0)
1000Water Transport ServiceFerry (4)
1001International Car Ferry ServiceFerry (4)
1002National Car Ferry ServiceFerry (4)
1003Regional Car Ferry ServiceFerry (4)
1004Local Car Ferry ServiceFerry (4)
1005International Passenger Ferry ServiceFerry (4)
1006National Passenger Ferry ServiceFerry (4)
1007Regional Passenger Ferry ServiceFerry (4)
1008Local Passenger Ferry ServiceFerry (4)
1009Post Boat ServiceFerry (4)
1010Train Ferry ServiceFerry (4)
1011Road-Link Ferry ServiceFerry (4)
1012Airport-Link Ferry ServiceFerry (4)
1013Car High-Speed Ferry ServiceFerry (4)
1014Passenger High-Speed Ferry ServiceFerry (4)
1015Sightseeing Boat ServiceFerry (4)
1016School BoatFerry (4)
1017Cable-Drawn Boat ServiceFerry (4)
1018River Bus ServiceFerry (4)
1019Scheduled Ferry ServiceFerry (4)
1020Shuttle Ferry ServiceFerry (4)
1021All Water Transport ServicesFerry (4)
1100Air ServiceBus (3)
1101International Air ServiceBus (3)
1102Domestic Air ServiceBus (3)
1103Intercontinental Air ServiceBus (3)
1104Domestic Scheduled Air ServiceBus (3)
1105Shuttle Air ServiceBus (3)
1106Intercontinental Charter Air ServiceBus (3)
1107International Charter Air ServiceBus (3)
1108Round-Trip Charter Air ServiceBus (3)
1109Sightseeing Air ServiceBus (3)
1110Helicopter Air ServiceBus (3)
1111Domestic Charter Air ServiceBus (3)
1112Schengen-Area Air ServiceBus (3)
1113Airship ServiceBus (3)
1114All Air ServicesBus (3)
1200Ferry ServiceFerry (4)
1300Aerial Lift ServiceGondola (6)
1301Telecabin ServiceGondola (6)
1302Cable Car ServiceGondola (6)
1303Elevator ServiceGondola (6)
1304Chair Lift ServiceGondola (6)
1305Drag Lift ServiceGondola (6)
1306Small Telecabin ServiceGondola (6)
1307All Telecabin ServicesGondola (6)
1400Funicular ServiceFunicular (7)
1401Funicular ServiceFunicular (7)
1402All Funicular ServiceFunicular (7)
1500Taxi ServiceBus (3)
1501Communal Taxi ServiceBus (3)
1502Water Taxi ServiceBus (3)
1503Rail Taxi ServiceBus (3)
1504Bike Taxi ServiceBus (3)
1505Licensed Taxi ServiceBus (3)
1506Private Hire Service VehicleBus (3)
1507All Taxi ServicesBus (3)
1600Self DriveBus (3)
1601Hire CarBus (3)
1602Hire VanBus (3)
1603Hire MotorbikeBus (3)
1604Hire CycleBus (3)
1700Miscellaneous ServiceBus (3)
1701Cable CarCablecar (5)
1702Horse-drawn CarriageBus (3)

The latest version of this mapping is maintained in transitland-lib.