Skip to content

GTFS

General Transit Feed Specification (GTFS) is a digital exchange format developed by Google for timetables used for public passenger transport services and relevant geographical information, such as locations of stops. Data is supplied by transport companies and published as an accumulated database in GTFS format on the Open Data Platform Swiss Public Transport. The data is used to develop applications relating to public transport, such as timetable queries.

Unlike GTFS Realtime (GTFS RT), GTFS Static, as the name suggests, only provides static data and no real-time data.

This static file is first used to present a country’s entire public transport operation in a single feed.

Technical description

GTFS Static is provided in ZIP format using a series of text files. Each file provides information about a particular aspect of the transit information, for instance, stops (stops.txt), routes (routes.txt), journeys (trips.txt), transport companies (agency.txt) and other timetable-related data. Some information is required to provide valid GTFS data, while other information is optional and provides useful additional information (e.g. changes to the timetable on specific public holidays = calendar_dates.txt).

The diagram below illustrates how the different types of information interact, showing that, at present, not all information has been recorded for public transport in Switzerland and is available in GTFS Format.

Klassen GTFS Static

GTFS Static classes

Access the relevant dataset at: https://opentransportdata.swiss/de/dataset/timetable-2021-gtfs2020

Key concepts

  • GTFS Realtime Publication of static transit information in GTFS format.
  • GTFS Realtime: Publication of real-time information to enhance the static GTFS Data, in the form of protocol buffers.

Technical aspects

Data structure

Each file comprises comma-separated rows of texts and numbers, which combine to provide the information being sought. A comprehensive description is provided of the individual fields in the various files on the following website: https://developers.google.com/transit/gtfs/reference/

The following files are currently provided for the GTFS export for public transport in Switzerland:

  • agency.txt.
  • calendar.txt.
  • calendar_dates.txt
  • feed_info.txt
  • routes.txt
  • stop_times.txt
  • stops.txt
  • transfers.txt being (being drafted)
  • trips.txt

The following are not available: fare_attributes.txt, fare_rules.txt, feed_info.txt and frequencies.txt

Agency.txt.

agency_id,agency_name,agency_url,agency_timezone,agency_lang,agency_phone
"11","Schweizerische Bundesbahnen SBB","http://www.sbb.ch/","Europe/Berlin","DE","0900 300 300 "
"801","PostAuto Schweiz","http://www.sbb.ch/","Europe/Berlin","DE","0900 300 300 "
"840","Busbetrieb Aarau","http://www.sbb.ch/","Europe/Berlin","DE","0900 300 300 "
"31","BDWM Transport (bd)","http://www.sbb.ch/","Europe/Berlin","DE","0900 300 300 "
"899","BDWM Transport (wm Auto)","http://www.sbb.ch/","Europe/Berlin","DE","0900 300 300 "
"886","Regionale Verkehrsbetriebe Baden-Wettingen","http://www.sbb.ch/","Europe/Berlin","DE","0900 300 300 "
"839","Zugerland Verkehrsbetriebe","http://www.sbb.ch/","Europe/Berlin","DE","0900 300 300

calendar.txt

service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
"TA+b000b","1","1","1","1","1","0","0","20161211","20171209"
"TA+b0001","1","1","1","1","1","1","1","20161211","20171209"
"TA+b0016","0","0","0","0","1","1","0","20161211","20171209"
"TA+b0dmg","0","0","0","0","0","0","1","20161211","20171209"
"TA+b12cr","1","1","1","1","0","0","0","20161211","20171209"
"TA+b0008","1","1","1","1","1","0","0","20161211","20171209"
"TA+b0027","1","1","1","1","1","1","0","20161211","20171209"
"TA+b0dnc","0","0","0","0","0","1","1","20161211","20171209"
"TA+b001r","1","1","1","1","1","0","1","20161211","20171209"
"TA+b001j","0","0","0","0","0","1","0","20161211","20171209"
"TA+b001t","0","0","0","0","0","0","1","20161211","20171209"
"TA+b04oi","1","1","1","1","1","0","0","20161211","20171209"
"TA+b0ch2","0","0","0","1","0","0","0","20161211","20171209

calendar_dates.txt

service_id,date,exception_type
"TA+b0003","20161226","2"
"TA+b0003","20170102","2"
"TA+b0003","20170414","2"
"TA+b0003","20170417","2"
"TA+b0003","20170501","2"
"TA+b0003","20170525","2"
"TA+b0003","20170605","2"
"TA+b0003","20170801","2"
"TA+b0007","20161226","2"
"TA+b0007","20170102","2"
"TA+b0007","20170414","2

feed_info.txt

feed_publisher_name,feed_publisher_url,feed_lang,feed_start_date,feed_end_date,feed_version
"SBB","http://www.sbb.ch/","DE","20161211","20171209","20170518

routes.txt

route_id,agency_id,route_short_name,route_long_name,route_desc,route_type
"91-10-A-j22-1","37","10","","T","900"
"91-10-B-j22-1","78","S10","","S","109"
"91-10-C-j22-1","11","S10","","S","109"
"91-10-E-j22-1","65","S10","","S","109"
"91-10-F-j22-1","11","RE10","","RE","106"
"91-10-G-j22-1","11","SN10","","SN","109"
"91-10-j22-1","3849","10","","T","900"
"91-10-Y-j22-1","82","IR","","IR","103"3

Please note:

  • Some routes in GTFS have an extension “-Y”. The reason for this is that they have a line number which has been created artificially. This is the only way that “route_short_name” can be valid. These artificial lines should therefore not be shown to users. In the case of trains, “trip_short_name” will include the train number.

The means of transport texts which are used (the variable route_desc contains informationen of the column “Abbreviation”):

Abbreviation DE FR IT EN Ref_TransportMode route_type
ASC Aufzug Ascenseur Ascensore Lift A 1700
B Bus Bus Bus Bus B 700
BN Nachtbus Bus ligne de nuit Bus notturno Nightbus B 705
BP PanoramaBus PanoramaBus Bus panoramico Panorama bus B 710
BUS Bus Bus Bus Bus B 700
CAR Fernbus national Bus longues distances national Bus nazionale a lunga percorrenza National long-distance bus B 202
CAX Fernbus international Bus longues distances international Bus internazionale a lunga percorrenza International long-distance bus B 201
EB Eilbus Bus acc‚l‚r‚ Bus accelerato Semi fast bus B 702
EXB Expressbus Bus express Bus espresso Express bus B 702
ICB InterCity-Bus InterCity-Bus InterCity-Bus Intercity-Bus B 202
KB Kleinbus Minibus Minibus Minibus B 700
NB Nacht-Bus Bus nocturne Bus notturno Night-Bus B 705
NFB Niederflur-Bus Bus … plancher surbaiss‚ Bus a pianale ribassato Low-floor bus B 700
NFO Niederflur-Trolleybus Trolleybus … plancher surbaiss‚ Filobus a pianale ribassato Low-floor trolley bus B 700
RUB Rufbus Bus sur appel bus a chiamata On-call bus B 715
TX Taxi Taxi Taxi Taxi B 1500
SL Sesselbahn T‚l‚siŠge Seggiovia Chairlift E 1300
CC Zahnradbahn Chemin de fer … cr‚maillŠre Cremagliera Rack-railroad H 1400
GB Gondelbahn T‚l‚cabine Cabinovia Gondola lift L 1300
LB Luftseilbahn T‚l‚ph‚rique Funivia Cableway L 1300
PB Pendelbahn T‚l‚ph‚rique … va-et-vient funivia a va e vieni aerial tramway L 1300
M Metro M‚tro Metropolitana Underground M 401
FUN Standseilbahn Funiculaire Funicolare Funicular N 1400
BAT Schiff Bateau Battello Ship S 1000
BAV Dampfschiff Bateau … vapeur Battello a vapore Steam ship S 1000
FAE F„hre Bac Traghetto Ferry-boat S 1000
KAT Katamaran Catamaran Catamarano Katamaran S 1000
NFT Niederflur-Tram Tram … plancher surbaiss‚ Tram a pianale ribassato Low-floor tramway T 900
T Tram Tram Tram Tramway T 900
TN Nachttram Tram ligne de nuit Tram notturno Nighttram T 900
AIR Flugzeug avion aeroplano aircraft U 1100
UUU Unbekannte Art Type inconnu Tipologia sconosciuta Unknown mode U 1700
AG Agenturzug Train d’agence Treno d’ agenzia Agencytrain Z 117
ARC Arco Arco Arco Arco Z 102
ARZ Autoreisezug Train autos-couch Treno navetta Car-carrying train Z 104
AT Autotunnelzug Train-auto Treno auto in galleria Car train Z 104
ATR Altaria Altaria Altaria Altaria Z 102
ATZ Autotunnelzug Train-auto Treno auto in galleria Car train Z 104
AVE Alta Velocidad ES Alta Velocidad ES Alta Velocidad ES Alta Velocidad ES Z 101
BEX Bernina Express Bernina Express Bernina Express Bernina Express Z 107
CAT City Airport Train City Airport Train City Airport Train City Airport Train Z 111
CNL CityNightLine CityNightLine CityNightLine CityNightLine Z 105
D Schnellzug Train direct Treno diretto Fast train Z 103
E Eilzug Train acc‚l‚r‚ Treno accelerato Semi fast train Z 103
EC EuroCity EuroCity EuroCity EuroCity Z 102
EM Euromed Euromed Euromed Euromed Z 102
EN EuroNight EuroNight EuroNight EuroNight Z 105
ES Eurostar Italia Eurostar Italia Eurostar Italia Eurostar Italia Z 101
EST Eurostar Eurostar Eurostar Eurostar Z 101
EXT Extrazug Train sp‚cial Treno speciale Special train Z 117
GEX Glacier Express Glacier Express Glacier Express Glacier Express Z 107
IC InterCity InterCity InterCity InterCity Z 102
ICE InterCityExpress InterCityExpress InterCityExpress InterCityExpress Z 102
ICN IC-Neigezug IC-pendulaire IC-pendolare IC-tilting train Z 102
IN InterCityNacht InterCityNuit InterCityNotte InterCityNight Z 102
IR InterRegio InterRegio InterRegio InterRegio Z 103
IRE Interregio-Express Interregio-Express Interregio-Express Interregio-Express Z 103
IT Italo Italo Italo Italo Z 102
JAT Gef„ngniszug Train prison Jail Train Jail Train Z 111
MAT LeermaterialZ (Reisezugswagen) Train de mat‚riel vide (voitures voyageurs) Materiale vuoto (treno viaggiatori) Empty material train (passenger carriage) Z 111
MP LeermaterialZ Personenbef”rd Train de mat‚riel vide avec transport de voyageurs Materiale vuoto con trasporto di persone Empty material train with passenger transport Z 111
NJ nightjet nightjet nightjet nightjet Z 105
NZ Nacht-Zug Train de nuit Treno notturno Night train Z 105
P Zug ohne Gew„hr Train non garanti Treno non garantito No guaranteed train Z 100
PE PanoramaExpress PanoramaExpress PanoramaExpress PanoramaExpress Z 107
R Regio Regio Regio Regio Z 106
RB Regionalbahn Train r‚gional Ferrovia regionale Regional train Z 106
RE RegioExpress RegioExpress RegioExpress RegioExpress Z 106
RJ Railjet Railjet Railjet Railjet Z 102
RJX railjet xpress railjet xpress railjet xpress railjet xpress Z 102
S S-Bahn RER Rete celere Urban train Z 109
SN Nacht-S-Bahn RER-nuit Rete celere notte Night-urban train Z 109
STB Stadtbahn Train urbain Ferrovia urbana City railway Z 109
TAL Talgo Talgo Talgo Talgo Z 101
TER Train Express Regional Train Express Regional Train Express Regional Train Express Regional Z 106
TE2 TER200 TER200 TER200 TER200 Z 106
TGV Train … grande vit. Train … grande vit. Train … grande vit. Train … grande vit. Z 101
THA Thalys Thalys Thalys Thalys Z 101
TLK Twoje Linie Kolejowe Twoje Linie Kolejowe Twoje Linie Kolejowe Twoje Linie Kolejowe Z 102
UEX UrlaubsExpress UrlaubsExpress UrlaubsExpress UrlaubsExpress Z 104
VAE Voralpen-Express Voralpen-Express Voralpen-Express Voralpen-Express Z 103
WB Westbahn Westbahn Westbahn Westbahn Z 100
X InterConnex InterConnex InterConnex InterConnex Z 100
X2 X2000 Neigezug X2000 pendulaire X2000 pendolare X2000 tilting train Z 100
ZUG Zugskategorie unbekannt Cat‚gorie du train inconnue Categoria di treno sconosciuta Train category unknown Z 100

stop_times.txt

trip_id,arrival_time,departure_time,stop_id,stop_sequence,pickup_type,drop_off_type
"1.TA.1-9-j17-1.1.H","05:25:00","05:25:00","8502034:0:2","1","0","0"
"1.TA.1-9-j17-1.1.H","05:28:00","05:29:00","8502033:0:2","2","0","0"
"1.TA.1-9-j17-1.1.H","05:33:00","05:33:00","8502032:0:1","3","0","0"
"1.TA.1-9-j17-1.1.H","05:36:00","05:36:00","8502031:0:1","4","0","0"
"1.TA.1-9-j17-1.1.H","05:42:00","05:42:00","8502030:0:2","5","0","0"
"1.TA.1-9-j17-1.1.H","05:50:00","05:50:00","8502119:0:7","6","0","0"
"2.TA.1-9-j17-1.2.H","05:53:00","05:53:00","8502034:0:1","1","0","0"
"2.TA.1-9-j17-1.2.H","05:57:00","05:58:00","8502033:0:2","2","0","0"
"2.TA.1-9-j17-1.2.H","06:02:00","06:02:00","8502032:0:1","3","0","0"
"2.TA.1-9-j17-1.2.H","06:04:00","06:04:00","8502031:0:1","4","0","0"
"2.TA.1-9-j17-1.2.H","06:09:00","06:11:00","8502030:0:2","5","0","0"
"2.TA.1-9-j17-1.2.H","06:20:00","06:20:00","8502119:0:7","6","0","0"
"3.TA.1-9-j17-1.3.H","24:38:00","24:38:00","8502119:0:7","1","0","0"
"3.TA.1-9-j17-1.3.H","24:46:00","24:46:00","8502030:0:1","2","0","0"
"3.TA.1-9-j17-1.3.H","24:49:00","24:49:00","8502031:0:1","3","0","0"
"3.TA.1-9-j17-1.3.H","24:52:00","24:52:00","8502032:0:1","4","0","0"
"3.TA.1-9-j17-1.3.H","24:57:00","24:57:00","8502033:0:1","5","0","0"
"3.TA.1-9-j17-1.3.H","25:01:00","25:01:00","8502034:0:1","6","0","0

stops.txt

stop_id,stop_name,stop_lat,stop_lon,location_type,parent_station
"1101064","Malpensa Aeroporto, terminal 1","45.6272144319203","8.7111160249179","",""
"8000339","Weissenhorn Eschach","48.3010036099201","10.135089480891","",""
"8000709:0:2","Neckarsulm Mitte","49.1934688770383","9.22294014126908","",""
"8000778","Asselheim (D)","49.5762169849528","8.16159859923981","",""
"8000781","Grünstadt-Nord","49.5733510011593","8.17078836459763","",""
"8000988","Witzighausen","48.3174402469306","10.097800413442","",""
"8002015","Nördlingen","48.85084676195","10.4978651252803","","8002015P"
"8002015:0:4","Nördlingen","48.85090587299","10.4978651252803","","8002015P"
"8002015P","Nördlingen","48.85084676195","10.4978651252803","1",""
"8002023","Ebermergen","48.7562093140126","10.7109634770088","",""
"8002023:0:1","Ebermergen","48.7562685367003","10.7109634770088","",""
"8002038","Möttingen","48.8068073922247","10.5978386332639","","8002038P"
"8002038:0:1","Möttingen","48.8069257181851","10.5978386332639","","8002038P"
"8002038:0:2","Möttingen","48.8068665552398","10.5978386332639","","8002038P"
"8002038P","Möttingen","48.8068073922247","10.5978386332639","1",""
"8002039","Hoppingen","48.8038195691943","10.6532018042319","","

The platforms must be modelled in GTFS as individual stops. Replacing the platform is then the same as replacing the stop from a GTFS perspective.

x2123

 

Example using “8500010” (Basel SBB):

basel

All the stops in Basel have a common “parent” “8500010P”. The individual platforms are separated by “:”. A “platform” can also be a platform+sectors (e.g. “8500010:0:7CD”). There are also very strange additions, such as “Bern Bfpl”, giving “8507000:0:Bfpl” if the RBS uses it for rail replacement buses.

trips.txt

route_id,service_id,trip_id,trip_headsign,trip_short_name,direction_id
"1-9-j17-1","TA+b0001","2.TA.1-9-j17-1.2.H","Lenzburg","21916","0"
"1-90-j17-1","TA+b0001","4.TA.1-90-j17-1.2.R","Wallbach, Gemeindehaus","90074","1"
"1-90-j17-1","TA+b0001","10.TA.1-90-j17-1.2.R","Wallbach, Gemeindehaus","90022","1"
"1-90-j17-1","TA+b0001","43.TA.1-90-j17-1.13.R","Schupfart, Dorf","90071","1"
"1-90-j17-1","TA+b0001","44.TA.1-90-j17-1.13.R","Schupfart, Dorf","90013","1"
"1-90-j17-1","TA+b0001","50.TA.1-90-j17-1.13.R","Schupfart, Dorf","90067","1
"8002015P","Nördlingen","48.85084676195","10.4978651252803","1",""
"8002023","Ebermergen","48.7562093140126","10.7109634770088","",""
"8002023:0:1","Ebermergen","48.7562685367003","10.7109634770088","",""
"8002038","Möttingen","48.8068073922247","10.5978386332639","","8002038P"
"8002038:0:1","Möttingen","48.8069257181851","10.5978386332639","","8002038P"
"8002038:0:2","Möttingen","48.8068665552398","10.5978386332639","","8002038P"
"8002038P","Möttingen","48.8068073922247","10.5978386332639","1",""
"8002039","Hoppingen","48.8038195691943","10.6532018042319","","
"1-350-j16-1","TA","49.TA.1-350-j16-1.2.R","1-350-j16-1.2.R","Zürich, Triemli","1"

Please note:

  • In the case of trains, “trip_short_name” will include the train number.
  • A “trip” according to GTFS represents in Transmodel the concept of a “DatedVehicleJourney” (in OJP a “DatedJourney”).  In Transmodel and OJP a TRIP is a journey of the customer as returned by the Trip Planner. It consists of different partial journeys, interchanges and other paths to be covered with different modes. In HRDF the GTFS ‘trip’ corresponds to the journey and in NeTEx to the ServiceJourney.

transfers.txt

The metastations will soon be presented in transfers.txt.

Consistency in terms of identifying between versions of the static file

The GTFS Static is recreated every week. This means that the “service_id” and the “trip_id” may not be identical.

When are there new GTFS Static files?

The new HRDF is published on Mondays.

The GTFS upload is carried out via script on Wednesdays at 09:10. The GTFS-RT feed downloads the files at 14:00 via script. It then takes about 5-10 minutes before the files in the system and, therefore, the GTFS-RT feed are switched.

Internal consistency of a GTFS Static file

We make every effort to produce correct GTFS Static files. Google suggests testing the internal consistency using the FeedValidator. Unfortunately, the current version is unable to cope with the size of our file. Another tool that can be used is gtfstidy, which includes among its functions the option to carry out validation using the parameter “-v”

More detailed information

You can find more detailed information about GTFS Static on Google’s GTFS developer website: https://developers.google.com/transit/gtfs/