Static data

Obs: Detta innehåll finns inte tillgängligt på svenska. Därför ser du engelska versionen. Om du tycker att denna sida borde översättas till svenska, kan du skriva till oss på support.trafiklab.se.

Om du vill se webbsidan på engelska, klicka här.

The static GTFS Regional dataset contains files describing all planned public transport data. It can be combined with optional realtime data available in the GTFS Realtime data API. The data in this dataset is updated on a daily basis, typically between 03:00 and 07:00.

In order to retrieve the static data you need an API key. Technical details for fetching the data can be found in the API’s OpenAPI specification. Trafiklabs GTFS documentation can help you to get started with GTFS files.

Where to download

The dataset can be accessed through the following URL:

https://opendata.samtrafiken.se/gtfs/{operator}/{operator}.zip?key={apikey}

Replace {operator} with the abbreviation of the operator you want to download. These abbreviations can be found in the OpenAPI specification, but are also listed on the overview page for this API. Replace {apikey} with your own API key. If you don´t have a key yet, read here on how to get one.

API key levels

LevelMaximum calls per minuteMaximum calls per month
Bronze1050
Silver10250
Gold202500

GTFS Extensions

GTFS Regional uses some of the GTFS Extensions. These extensions are not part of the specification, but are additions to offer additional details.

Extended route types

Extended route types allow for more specific transport modes to be used. GTFS Regional does not use the standard one digit GTFS route types, but uses only extended route types.

The following list shows the most used transport modes. This is a non-extensive list, only meant to give an idea of the types you should support. You should still be able to handle the other types in a graceful way, as new traffic may make use of them without prior warning.

CodeNameExample
100Railway Service
401Metro Service
700Bus Service
717Share Taxi ServiceAdvance order traffic (Förbeställningstrafik)
900Tram Service
1000Water Transport ServiceFerry, pendelbåt

Trip-to-trip transfers

Trip to trip transfers make use of the from_trip_id and to_trip_id columns in the transfers.txt file.

From Googles documentation:

The from_trip_id and to_trip_id fields can contain a trip_id, as specified by trips.txt. If from_trip_id is specified, the transfer will only apply to the arriving trip with the given trip id, at the given from_stop_id. If to_trip_id is specified, the transfer will only apply to the departing trip with the given trip id, at the given to_stop_id.

Notes and known issues

  • Since GTFS defines vehicle types on a route-level, the vehicle-type for some trips might be incorrect if those trips deviate from the route’s most common vehicle type. This can for example happen when some trips on a bus route are executed with a taxi instead of a bus.
  • Calendar.txt is only used to define validity periods, not to define service dates. Actual service dates are described in calendar_dates.txt.
  • When both route_short_name and route_long_name have a value, route_long_name should be considered the correct line name. In this case, route_short_name should only be used for systems that cannot show the long name.
  • There might be differences between GTFS Sverige 2 and GTFS Regional Static, for example in the validity period for routes which might be longer in GTFS Sverige 2. This is due to the higher detail of the GTFS Regional Static dataset.
  • GTFS Regional contains transfers between stop points within the same stop, as well as transfers between different stop areas and transfers to and from specific trips.