GTFS

Brief description

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.

Access the Data/APIs

https://data.opentransportdata.swiss/en/dataset/timetable-2025-gtfs2020 (2025)

Functional 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://data.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 description

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.

route_type and route_desc (column ‘Abbreviation’) correspond to the means of transport shown in the table below. We use a widely used list of route_type deviating from the standard list (which only has 10 values for route_type):

AbbreviationDEFRITENroute_type
ASCAufzugAscenseurAscensoreLift / Elevator1303
BBusAutobusAutobusBus700
BNNachtbusBus de nuitAutobus notturnoNight Bus705
BPPanoramaBusBus panoramiquePanoramaBusPanorama Bus710
BUSBusAutobusAutobusBus700
CARFernbus nationalBus longue distance nationalAutobus nazionale a lunga percorrenzaNational long-distance bus202
CAXFernbus internationalBus grandes lignes internationalAutobus a lunga percorrenza internazionaleInternational long-distance bus201
EBEilbusBus expressAutobus espressoSemi fast bus702
EXBExpressbusExpressbusExpressbusExpress bus702
ICBInterCity-BusBus InterCityAutobus InterCityInterCity Bus202
KBKleinbusMinibusFurgoncinoMinibus700
NBNacht-BusBus de nuitBus notturnoNight Bus705
NFBNiederflur-BusBus à plancher surbaisséBus a pianale ribassatoLow-floor bus700
NFONiederflur-TrolleybusTrolleybus à plancher surbaisséFilobus a pianale ribassatoLow-floor trolley bus700
RUBRufbusBus sur appelBus a chiamataOn-demand Bus715
TXTaxiTaxiTassìTaxi1500
SLSesselbahnTélésiègeSeggioviaChairlift1300
CCZahnradbahnChemin de fer à crémaillèreFerrovia a cremaglieraRack-railroad / Cog Railway1400
GBGondelbahnTélécabineOvoviaGondola lift1300
LBLuftseilbahnTéléphériqueFuniviaCableway / Aerial Ropeway1300
PBPendelbahnTéléphérique à mouvement de va-et-vientFunivia a movimento va e vieniAerial Tramway1300
MMetroMétroMetropolitanaUnderground / Metro401
FUNStandseilbahnFuniculaireFunicolareFunicular1400
BATSchiffBateauBattelloShip / Boat1000
BAVDampfschiffBateau à vapeurBattello a vaporeSteam ship / boat1000
FAEFähreTraversier / FerryNave traghettoFerry1000
KATKatamaranCatamaranCatamaranoKatamaran1000
NFTNiederflur-TramTram à plancher surbaisséTram a pianale ribassatoLow-floor Tramway900
TTramTramTramTram900
TNNachttramTram de nuitTram notturnoNight Tram900
AIRFlugzeugAvionVelivoloAirplane1100
UUUUnbekannte ArtEspèce inconnueSpecie sconosciutaUnknown mode1700
AGAgenturzugTrain de l’agenceTreno d’agenziaAgency Train117
ARCArco ARCOARCOArco102
ARZAutoreisezugTrain d’autos accompagnéesTreno auto accompagnateCar-carrying Train104
ATAutotunnelzugTrain-autos TunnelTreno per il trasporto di auto in galleriaAuto Tunnel Train104
ATRAltariaAltariaAltariaAltaria102
ATZAutotunnelzugTrain-autos TunnelTreno per il trasporto di auto in galleriaAuto Tunnel Train104
AVEAlta Velocidad ESAlta Velocidad ESAlta Velocidad ESAlta Velocidad ES101
BEXBernina ExpressBernina ExpressBernina ExpressBernina Express107
CATCity Airport TrainCity Airport TrainTreno città-aeroportoCity Airport Train111
CNLCityNightLineCityNightLineCityNightLineCityNightLine105
DSchnellzugTrain ExpressTreno espressoFast Train103
EEilzugTrain accéléréTreno espressoSemi fast / non-stop Train103
ECEuroCityEuroCityEuroCityEuroCity102
EMEuromedEuromedEuromedEuromed102
ENEuroNightEuroNightEuroNightEuroNight105
ESEurostar ItaliaEurostar ItaliaEurostar ItaliaEurostar Italia101
ESTEurostarEurostarEurostarEurostar101
EXTExtrazugTrain spécialTreno specialeSpecial Event Train117
GEXGlacier ExpressGlacier ExpressGlacier ExpressGlacier Express107
ICInterCityInterCityInterCityInterCity102
ICEInterCityExpressInterCity-ExpressInterCityExpressInterCityExpress102
ICNIC-NeigezugTrain pendulaire ICTreno basculante ICIC Tilting Train102
INInterCityNachtNuit InterCityInterCityNightInterCityNight102
IRInterRegioInterRegioInterRegioInterRegio103
IREInterregio-ExpressInterregioExpressInterregio-ExpressInterregio-Express103
ITItaloItaloItaloItalo102
JATGefängniszugTrain-prisonTreno della prigioneJail / Prison Train111
MATLeermaterialZug (Reisezugswagen)Train de matériel vide (voiture de voyageurs)Treno vuoto (carrozze passeggeri)Empty material train (passenger carriage)111
MPLeermaterialZug PersonenbefördTrain de matériel vide Transport de personnesTreno materiale vuoto Trasporto passeggeriEmpty material train with passenger transport111
NJNightJetNightJetNightjetNightJet105
NZNacht-ZugTrain de nuitTreno notturnoNight Train105
PZug ohne GewährTrain non garantiTreno senza garanziaTrain without Guarantee100
PEPanoramaExpressPanoramaExpressPanoramaExpressPanoramaExpress107
RRegioTrain régionalRegioRegio106
RBRegionalbahnRéseau régionalFerrovia regionaleRegional train106
RERegioExpressRegioExpressRegioExpressRegioExpress106
RJRailjetRailjetRailjetRailjet102
RJXrailjet xpressRailjet XpressRailjet XpressRailjet Xpress102
SS-BahnRERRete celere regionaleUrban Train109
SNNacht-S-BahnRER de nuitS-Bahn (rete celere regionale) notturnaNight-urban Train109
STBStadtbahnChemin de fer urbainFerrovia urbanaCity Railway109
TALTalgoTalgoTalgoTalgo101
TERTrain Express RegionalTrain Express régionalTreno espresso regionaleTrain Express Regional106
TE2TER200TER 200TER200TER200106
TGVTrain à grande vitesseTrain à grande vitesseTrain à grande vitesseTrain à grande vitesse101
THAThalysThalysThalysThalys101
TLKTwoje Linie KolejoweDeuxième Ligne KolejoweLinea Twoje KolejoweTwoje Line Kolejowe102
UEXUrlaubsExpressUrlaubsExpressHolidayExpressUrlaubsExpress (Holiday)104
VAEVoralpen-ExpressVoralpen-ExpressVoralpen-ExpressVoralpen-Express103
WBWestbahnWestbahnWestbahnWestbahn100
XInterConnexInterConnexInterConnexInterConnex100
X2X2000 NeigezugX2000 Train pendulaireTreno inclinabile X2000X2000 Tilting Train100
ZUGZugskategorie unbekanntCatégorie de train inconnueCategoria del treno sconosciutaTrain Category Unknown100

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,block_id,original_trip_id,hints "91-8-H-j25-1","TA+a0","994.TA.91-8-H-j25-1.59.R","Zürich, Hardturm","6278","1","","ch:1:sjyid:100648:plan:f7e839d9-e352-4394-98d3-3bbb9e89c18e","NF"
"91-8-H-j25-1","TA+a0","995.TA.91-8-H-j25-1.59.R","Zürich, Hardturm","2978","1","","ch:1:sjyid:100648:plan:1a4cadd1-b637-425e-a805-0dd1e5e34831","NF"
"91-8-H-j25-1","TA+a0","996.TA.91-8-H-j25-1.59.R","Zürich, Hardturm","2787","1","","ch:1:sjyid:100648:plan:649d9606-64db-4daa-9356-770b19699be8","NF"
"91-8-H-j25-1","TA+a0","997.TA.91-8-H-j25-1.59.R","Zürich, Hardturm","4879","1","","ch:1:sjyid:100648:plan:7a49feb0-47b5-4fd7-9034-ce68f65225d3","NF"
"91-8-H-j25-1","TA+2d600","998.TA.91-8-H-j25-1.59.R","Zürich, Hardturm","10407","1","","ch:1:sjyid:100648:plan:95e7bbc4-c839-4932-8ee3-e82e0c355fc5","NF"
"91-8-H-j25-1","TA+2d600","999.TA.91-8-H-j25-1.59.R","Zürich, Hardturm","9788","1","","ch:1:sjyid:100648:plan:c35e7a02-b42d-49db-8763-4bdcd39a6282","NF"
"91-8I-Y-j25-1","TA+3c100","1.TA.91-8I-Y-j25-1.1.H","Arth-Goldau","3092","0","","ch:1:sjyid:100001:3092-001","1 FS FW PA RR SC VN Z TC-004002"
"91-8I-Y-j25-1","TA+3c100","2.TA.91-8I-Y-j25-1.2.R","Lugano","3093","1","","ch:1:sjyid:100001:3093-001","1 FS FW PA RR SC VN Z TC-004002"
"91-8-j25-1","TA+c6","1.TA.91-8-j25-1.12.H","Bern, Saali","2076","0","","","NF VB"

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.
  • (from 12.12.2024) We use the original_trip_id as defined for GTFS Transit (https://developers.google.com/transit/gtfs/reference). The field contains the Swiss Journey ID (SJYID), which establishes an N:1 relationship between trip_id and SJYID. The SJYID is only unique on a daily basis. It is also shown in the GTFS-RT.
  • The “hints” field contains the traffic information in accordance with the industry standard passenger information. The tariff codes are also included as TC-<code>.

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 (basis for GTFS-S) is published on Wednesdays and Fridays, the GTFS static based on it is published the following day between 9 and 10 am.

The corresponding GTFS-RT feed is activated on the same day at 3 pm. (Since 2024-09-26, the appropriate GTFS static version is referenced in the header via FeedVersion, see GTFS-RT documentation)

Please note: There will be no updates on public holidays (e.g. Easter Monday, Whit Monday, etc.).

publication HRDFpublication GTFS-Sactivation GTFS-RT
FridayMonday between 9 and 10 amMonday 3 pm
WednesdayThursday between 9 and 10 amThursday 3 pm

In case of problems: The GTFS Static export will be published as soon as possible, GTFS Realtime approx. 5-6 hours later, but no later than 18:00 on the same day. If this is not possible, the new data will be activated in GTFS-RT on the following day.

Example: The new GTFS static data could only be published this afternoon. The GTFS Realtime data will be activated tomorrow at approx. 08:00.

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”

 

Questions & answers

What do the first and last two sections of the trip_id mean? E.g. {405}.TA.26-752-j17-1.{3}.{R}The trip_id consists of the following parts: “<consecutive number in trips.txt>.<service_id>.<route_id>.<DIVA route number>.<DIVA direction of travel>”

route_id = <DIVA branch of operation>-<DIVA line number>-<DIVA project abbreviation>-<DIVA line version number>

What is the Trip ID made up of?The trip ID is made up of different DIVA numbers/fields and has nothing to do with the HRDF data.

The assignment is not quite 1:1, as the journey ID (= journey number) does not have to be unique within an HRDF data set, but with the help of stops and stop times, as the data user has done, the matching journey can be found as follows::

The trips.txt contains the trip_short_name:

route_id,service_id,trip_id,trip_headsign,trip_short_name,direction_id

“26-94-j18-1″,”TA+b20xg”,”310.TA.26-94-j18-1.3.R”,”Zürich Oerlikon, Bahnhof”,”13628“,”1”

 

This corresponds to the journey number (external train number) in the *Z line of the FPLAN file:

unbenannt

As the journey number does not have to be unique within an HRDF feed, the stop times and stop_ids of the journey from the stop_times.txt should also be used for assignment:

 

trip_id,arrival_time,departure_time,stop_id,stop_sequence,pickup_type,drop_off_type

“310.TA.26-94-j18-1.3.R”,”13:37:00″,”13:37:00″,”8587651″,”1″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:38:00″,”13:38:00″,”8587652″,”2″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:39:00″,”13:39:00″,”8591263″,”3″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:41:00″,”13:41:00″,”8591347″,”4″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:42:00″,”13:42:00″,”8591047″,”5″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:43:00″,”13:43:00″,”8591113″,”6″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:44:00″,”13:44:00″,”8591330″,”7″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:45:00″,”13:45:00″,”8591319″,”8″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:46:00″,”13:46:00″,”8591175″,”9″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:46:00″,”13:46:00″,”8591273″,”10″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:48:00″,”13:48:00″,”8591382″,”11″,”0″,”0″

“310.TA.26-94-j18-1.3.R”,”13:49:00″,“13:49:00″,”8580449”,”12″,”0″,”0″

The HRDF feed two days later (e.g. 05/02/2018) always matches the GTFS feed (e.g. 07/02/2018):

unbenannt

Further information