Train Movements: Difference between revisions
PeterHicks (talk | contribs) m Added details of the names of topics |
PeterHicks (talk | contribs) m Tidy-up |
||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
=== What is this feed? === | |||
The Train Movements feed contains data from Network Rail's [http://en.wikipedia.org/wiki/TRUST TRUST] system. This reports on the progress of trains along their journey. | |||
=== Topics === | === Topics === | ||
Messages are available on TOC-specific topics, as well as an 'ALL TOCs' topic. | |||
Individual TOC topics are named TRAIN_MVT_XX_TOC, where 'XX' represents the Network Rail 'business code' from the [[TOC Codes]] page. For example, CrossCountry has business code 'EH', and its topic is TRAIN_MVT_EH_TOC. | |||
There are other topics which contain aggregated data from multiple TOCs: | |||
{| border="1" | {| border="1" | ||
Line 18: | Line 24: | ||
|- | |- | ||
|TRAIN_MVT_GENERAL | |TRAIN_MVT_GENERAL | ||
| | |Change of Identity messages for freight trains | ||
|} | |} | ||
=== Message types === | === Message types === | ||
The | The feed contains eight message types, all in JSON format: | ||
* 0001 - [[Train Activation]] | * 0001 - [[Train Activation]] | ||
Line 34: | Line 40: | ||
* 0008 - [[Change of Location]] | * 0008 - [[Change of Location]] | ||
An [[Activation]] message will always be the first message to be received for a train, after which any of the other message types may be received. | |||
=== Format === | === Format === |
Revision as of 12:45, 17 January 2013
Overview
What is this feed?
The Train Movements feed contains data from Network Rail's TRUST system. This reports on the progress of trains along their journey.
Topics
Messages are available on TOC-specific topics, as well as an 'ALL TOCs' topic.
Individual TOC topics are named TRAIN_MVT_XX_TOC, where 'XX' represents the Network Rail 'business code' from the TOC Codes page. For example, CrossCountry has business code 'EH', and its topic is TRAIN_MVT_EH_TOC.
There are other topics which contain aggregated data from multiple TOCs:
Topic name | Description |
---|---|
TRAIN_MVT_ALL_TOC | All train operating companies |
TRAIN_MVT_PASSENGER_TOC | All passenger train operating companies |
TRAIN_MVT_GENERAL | Change of Identity messages for freight trains |
Message types
The feed contains eight message types, all in JSON format:
- 0001 - Train Activation
- 0002 - Train Cancellation
- 0003 - Train Movement
- 0004 - Unidentified Train
- 0005 - Train Reinstatement
- 0006 - Change of Origin
- 0007 - Change of Identity
- 0008 - Change of Location
An Activation message will always be the first message to be received for a train, after which any of the other message types may be received.
Format
Each message is represented as a JSON hash with two keys - 'header' and 'body'. Zero or more of these messages is sent out in a JSON list, either every five seconds or when there are 32 messages to be sent. It is perfectly legitimate to receive an empty array.
All timestamp values are in milliseconds since the UNIX epoch.