0.0.2 • Public • Published

Belgian Rail 2 stoptimes

This project generates a stream of real stoptimes between 2 time intervals for a list of stops

A stoptime?

Yes! A stoptime is 1 arrival and departure of 1 train on 1 location (a platform or station).

We particularly use the term "stoptime", as we use the stoptime ontology defined by the Open Knowledge Open Transport Working Group.

1 stoptime looks something like this:

{ "stop" : "",
  "departureTime" : "2014-12-15T18:02:00Z",
  "headsign" : "Antwerpen-Centraal",
  "@id" : "",
  "arrivalTime" : "2014-12-15T18:00:00Z",
  "provenance" : "Charleroi-Sud"

How do I use it?

Easy! You install this repo using npm in your own project and you can start doing fun things:

npm install brail2stoptimes --save

And now use it in your project as follows:

var BRail2StopTimesStream = require("brail2stoptimes");
//you can find these identifiers in our repository or check the bin/example.js file
var stations = ["008718201","008718206","008500010","008832664"];
var stoptimesstream = new BRail2StopTimesStream(stations, "en", new Date(), new Date() + 2); //get for 2 days
stoptimesstream.on("data", function (stoptime) {
  //do something with it:
  if (stoptime) {

What now?

You can ingest this data in e.g., mongodb (check the bin directory) or start creating data dumps such as a GTFS dump. If you've done something, please let me know through the issue tracker.

How does it work?

It works in two steps:

  • It scrapes all stations for arrival and departure times
  • It looks up the train numbers and fetches a link to the nextStopTime

For each stoptime, we need max 4 requests:

  1. To obtain the departures in a station
  2. To obtain the arrivals in a station and link them to the departures
  3. To obtain the nextStopTime link (will be cached per train number)
  4. To obtain the nextStopTime data itself (will be cached per train number)




Package Sidebar


npm i brail2stoptimes

Weekly Downloads






Last publish


  • pietercolpaert