Skip to content
A realtime stream for positions of buses and trains.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitignore
.travis.yml
example.js
index.js
license.md
package.json
readme.md
test.js
wat.png

readme.md

vbb-positions-stream

Get realtime positions of VBB vehicles in a certain area.

well

npm version build status ISC-licensed gitter channel support me on Patreon

Installing

npm install vbb-positions-stream

Usage

positions returns a readable stream in object mode.

const positions = require('vbb-positions-stream')

const readable = positions({
	north: 52.5,
	west: 13.385,
	south: 52.495,
	east: 13.395
})
let i = 0
readable.on('data', (movement) => {
	console.log(movement)
	if (++i >= 5) readable.destroy() // stop receiving positions
})
{
	tripId: '84/32569/18/21/86',
	mode: 'train',
	product: 'subway',
	latitude: 52.498064,
	longitude: 13.391617,
	when: 1534763850777,
	line: 'U6'
}
{
	tripId: '84/32569/18/21/86',
	mode: 'train',
	product: 'subway',
	latitude: 52.497938,
	longitude: 13.391581,
	when: 1534763852777,
	line: 'U6'
}
{
	tripId: '84/32569/18/21/86',
	mode: 'train',
	product: 'subway',
	latitude: 52.497813,
	longitude: 13.391545,
	when: 1534763854777,
	line: 'U6'
}
{
	tripId: '84/32569/18/21/86',
	mode: 'train',
	product: 'subway',
	latitude: 52.497678,
	longitude: 13.391509,
	when: 1534763856777,
	line: 'U6'
}
{
	tripId: '84/32569/18/21/86',
	mode: 'train',
	product: 'subway',
	latitude: 52.497552,
	longitude: 13.391473,
	when: 1534763858777,
	line: 'U6'
}

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.

You can’t perform that action at this time.