Till senaste kommentaren
Detta inlägg är gammalt och kan innehålla inaktuell information.

Need real time updates on train traffic and network

I need to obtain real time (or near real time) updates on the Tunnelbana and commuter (Pendeltag) rail traffic. Details such as train positions, delays, time arrived at station, position of train and so on. I was wondering if this real time information is available, (through one API call) and which API to use for that.

I have gone through the various APIs, and could not find any API which would provide real time information. I could find mostly schedule information. Could you please help me out?



  • Hej Jayanth!

    The boring answear is, you can't. 🙁

    The only realtime information you can get is esitmated time of departure on a station for commutertrains. (And other trafic than the tunnelbana)

    Exampel: https://api.trafiklab.se/sl/realtid/GetDpsDepar......

    You will find: ExpectedDateTime

    For the Tunnelbana it is an really old system, and it can only support you with the same infromation you can read on the sign by the stations.

    Exampel: https://api.trafiklab.se/sl/realtid/GetDepartur......

    You will find: DisplayRow1 and DisplayRow2 in the response.

    Positions is a frequently requested feature, and some investigations are made how such an API could be feeded with data, but we all have to be patient.

    / Lars

  • Hello,

    Thanks for the response. I am basically looking to get an estimate of delays in the train systems for a research project. Am I correct in assuming that the difference between the values for TimeTabledDateTime and ExpectedDateTime in the GetDpsDepartures response should provide me with this estimate?

    Further, I am looking currently at trains within the Stockholm region. Is there a way to get the station ids for Stockholm? I could use the Samtrafiken or the Train Export API to get a list of all stations and ids in Sweden, but is there a way to filter it based on a region?

    Also, is it possible to get the same train data as provided by the Real Time API in a bulk fashion, using perhaps the Train Export API?

    Please let me know if these things are possible.


  • Hi,

    I am looking for the answer to Jayanth's question..
    please soon

  • Hi Ruchi,

    Realtime information is available through our GTFS Regional feed. If you need realtime data for Stockholm, there are also the SL APIs.

    Bert på Trafiklab
  • Hi Bert,
    Thanks for the response and I am already using data you mentioned.
    but I SPECIFICALLY need the delay info.
    Example: train from slussen to T-Central gor delayed by 10 minutes(so expected arrival was 13:00 but it reached 13:10). this kind of information I needed please.

  • Hi Ruchi,

    As I stated in my previous answer, this data is available both through the GTFS Regional API and through SL's Realtid API.

    Bert på Trafiklab
  • Thanks again for reply,
    When I call methods from the GTFS Regional Realtime (beta), I get below error..
    (Both the Error files attached)

    Is it temporary, permanent?

  • Please replace <API-KEY> with the API key you created.
    Please note that there currently are some issues with the SL realtime feed, you can use the old "GTFS Regional (beta, OLD)" API in the meanwhile.

    Bert på Trafiklab

Kommentera eller skriv ett nytt inlägg

Ditt namn och inlägg kan ses av alla. Din e-post visas aldrig publikt.