vbb
vbb is a JavaScript API for the Berlin & Brandenburg public transport service (VBB). It puts a consistent and straightforward promise-based interface on top of the verbose HAFAS REST API. vbb is MIT-licensed and embraces prototypal programming.
Installing
npm install vbb
Getting Started
We require
the vbb factory function and pass the API key.
var vbb = ;var client = ;
We have access to three methods now:
locations
to find stations, addresses and POIsroutes
to get routes between locationsdepartures
to query the next departures at a station
As an example, we will search for a route from Berlin Hauptbahnhof to Berlin Charlottenburg.
First, we have to look up the id
s of those two stations:
var Promise = ; Promise;
The output will have the following structure:
duration: 600000 // milliseconds parts: // all "sections" of the route from: title: 'S+U Berlin Hauptbahnhof' latitude: 52525849 longitude: 13368928 id: 9003201 type: 'station' notes: lift: true tactilePaving: true escalator: true when: Sat Aug 01 2015 15:48:00 GMT+ // `Date` object to: title: 'S Charlottenburg Bhf (Berlin)' latitude: 52505048 longitude: 13305212 id: 9024101 type: 'station' notes: {} when: Sat Aug 01 2015 15:58:00 GMT+ // `Date` object transport: 'public' // another value: `'walk'` type: 'suburban' // another value: `'subway'` direction: 'S Spandau Bhf (Berlin)' notes: {}
Documentation
Contributing
If you have a question, found a bug or want to propose a feature, have a look at the issues page.