Status October 2024. You can find information on continuous adjustments in our Changelog.
Background
What is formation data?
Formation data is information about the wagons (and locomotives) of a train. They contain not only the position of the individual wagons in a train, but also their characteristics. For example, the formation data can be used to find out which wagon of a specific train (e.g. train number 1234) provides low-floor access, i.e. allows easy access for wheelchairs or pushchairs.
Who is behind it?
The service is provided by the Customer Information Plus (SKI+) system tasks team on behalf of the Federal Office of Transport (FOT) in Switzerland.
We obtain the data on the formations from two systems:
- The Formation Service (FOS) is the SBB interface to which various railway undertakings (RUs) submit their formation data.
- The means of transport interface of the real-time system (CUS) of the Customer Information System (SKI), which manages the real-time data of all means of public transport.
While the FOS interface “only” provides the details of the formations, the CUS interface enriches the data with details such as the position of the wagons (sectors) on the track at the stops.
Why does the Open Data platform offer this?
Knowledge about the formation of a train can be used to inform users about it:
- at which sector of a track of a railway station wheelchair access is possible (which is particularly important in the context of the Disability Discrimination Act (BehiG))
- in which carriages bicycle hooks are available
- how many seats are generally available in a carriage
- In combination with our occupancy forecast, the occupancy (train-wide) can even be displayed
- which locomotive and wagon types run on which routes (e.g. for trainspotters, or for transport companies that combine their services with the railways)
How do I access the data/interfaces?
Data
As formation data is constantly changing, we do not offer it as a data export, but only as an interface. Interfaces The formation data is provided here: https://opentransportdata.swiss/dataset/formations |
Technical description
Which services (interface endpoints) does the formation data interface offer?
The formation data interface supports the following request variants. The details of the requests are also documented via the OpenAPI interface:
- Stops based
- You use the endpoint for this: formations_stop_based
- What the service does:
- Determine the formations per stop of a train’s journey.
- What the service needs:
- The name of an RU: The list of authorised RUs is limited to those who have given their consent to the use of their formation data.
- An operating day: The day for which the formation is to be queried. The date cannot be in the past. The date can only be today +3 days (due to the inclusion of real-time data from CUS).
- The train number (also known as the means of transport number): The train for which you want to request the formation. This number can be obtained in various ways, including via our timetable data (in various data formats).
- What the return service gives:
- The stops of a train, with the details of the stops, the formation with which the train departs from the stops, and when, from which track, and with which locomotives/wagons stay together until where. The decisive factor here is that we specify the formation in a compact notation that has its origin in CUS!
- This query does not contain all the details for each wagon.
- The interpretation of the formation short string is described below!
- Possible use case: Display the formation of a train on a track for a specific stop.
- Train based
- To do this, use the endpoint: formations_vehicle_based
- What the service does:
- Determine the formations per vehicle (i.e. per formation element) of the train.
- What the service needs:
- The parameters are the same as for formations_stop_based
- What the service gives:
- The formation elements with the details of each vehicle, the position of the vehicle in the formation, as well as the stops at which the vehicle stops along the journey with the details of the stop, and the track and sector at which the vehicle stops at the respective stops.
- This query does not include the overall view of the train along the stops.
- Possible use case: Tracking a specific vehicle.
- Stops and train based
- To do this, use the endpoint: formations_full
- What the service does:
- The formations can be issued both per stop and per vehicle.
- What the service needs:
- The parameters are the same as for formations_stop_based and formations_vehicle_based
- What the service gives:
- The stops AND the formation elements as in the respective variants described above.
Interpretation of the formation short string:
Basically, the structure of the string differs depending on whether a track has sectors or whether these are known to us. | ||||||||||||||||||
In any case, the following applies to the structure:
|
What are the most important terms and concepts to know?
We use the following elements as part of our interface (without container elements)
- StopPoint
- A StopPoint is a stop along the timetable
- StopTime
- The departure and arrival time
- Track
- The track at the StopPoint
- FormationShortString
- The short representation of the formation (as defined by CUS)
- VehicleGoal
- Which carriages stay together until which destination as seen from a stop
- JourneyMetaInformation
- Clear identification of the journey
- TrainMetaInformation
- Descriptive properties of the train
- FormationMetaInformation
- Details of the entire formation, e.g. number of vehicles
- ScheduledStop
- StopPoint, StopTime, Track, details on how the train is handled at the stop (e.g. whether the train stops or passes through), as well as deviations in the journey (e.g. whether the train stops or passes through). Delays on arrival)
- VehicleIdentifier
- Attributes that uniquely identify a vehicle, such as the European vehicle number (EVN). A special feature here is that a vehicle can be part of an articulated train and therefore does not have its own EVN, but only a “generated” one. In this case, please refer to the “Parental EVN”.
- WheelchairSymbolProperties
- Properties required for determining the wheelchair symbol (see also Accessibility in the journey planner, German only)
- AccessibilityProperties
- Other features that can be used in terms of disability-friendly presentation
- PictoProperties
- Whether the various pictographs are displayed on a vehicle
- DirectTrolleyInformation
- If the formation represents direct carriages
- VehicleRelation
- This element allows you to track the previous and subsequent movement of the given formation, which can also be a direct carriage movement
- VehicleProperties
- Characteristics of a vehicle as part of a formation, i.e. a formation element, and from where to where the vehicle is part of the formation
- FormationVehicleAtScheduledStop
- The representation of the formation per stop (for the vehicle_based request)
- VehicleRelationship
- The journey relationship, i.e. how the journey changes between two journeys (e.g. if there is a cancellation)
- VehicleRelationshipDetails
- The details of a travelling relationship.
Restrictions
- The data is limited to the railway undertakings (RUs) that provide their formations via the Swiss Federal Railways (SBB) and have consented to the publication of their data as open data.
- The service only provides all data and the vehicle-based data if all sources (see note 1) have all the required data. This is particularly important when you consider that CUS only has data for today + 3 days.
- Specifically, the data comes from the SKI real-time system (CUS – CUstomer (Information) System – VerkehrsMittel (VM)) and SBB’s Formation Services (FOS).
Technical description
Access to the API
A token is required to be able to use the API/interface. This token can be obtained via the Developer Portal.
The specific endpoints
The three endpoints described above can be accessed via the following URLs:
- https://api.opentransportdata.swiss/formations_stop_based
- https://api.opentransportdata.swiss/formations_vehicle_based
- https://api.opentransportdata.swiss/formations_full
The parameters are as follows:
Parameter | Value description and example value |
evu | The RU for which the enquiry is to be made. Currently permitted: BLSP, SBBP, MBC, OeBB, RhB, SOB, THURBO, TPF, TRN, VDBB, ZB |
operationDate | The date on which the train runs and for which you want to make the request. E.g. 2024-09-18 |
trainNumber | The train number for which you want to query the formation data. E.g. 2806 |
includeOperationalStops | Whether the operational stops (usually not relevant for customers!) should also be output. E.g. false |
An example enquiry would therefore be: https://api.opentransportdata.swiss/formations_stop_based?evu=BLSP&operationDate=2024-09-18&trainNumber=2806&includeOperationalStops=false
We will not describe the complete data model here, but instead refer to the following YAML: formations_yaml_change_file_ending.txt (file is a “.txt”, must be changed to “.yaml”).
[a swagger documentation may be available here in the future]
Restrictions
- The interface exists as a beta as of October 2024 and is being continuously developed. This means that the data model can still change.