Skip to content

derhuerst/vbb-positions-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.