Awesome
fetch-commute-from-hafas
For a set commuting instructions, fetch journeys from HAFAS.
Installation
npm install fetch-commute-from-hafas
Usage
const createHafas = require('bvg-hafas')
const fetchJourneysForCommute = require('fetch-commute-from-hafas')
const commute = {
title: 'Seestr. to Potsdamer Platz via Friedrichstr.',
from: {
stop: '900000009103', // U Seestr.
bufferBefore: 6 * 60 * 1000 // 6 minutes
},
transfers: [{
stop: '900000100001', // S+U Friedrichstr.
buffer: 30 * 1000 // 30 seconds
}],
to: {
stop: '900000100020', // S+U Potsdamer Platz
bufferAfter: 2 * 60 * 1000 // 2 minutes
},
products: {bus: false}
}
const when = new Date('2019-02-18T10:00:00+01:00')
const hafas = createHafas('render-berlin-commute example')
fetchJourneysForCommute(hafas, commute, when)
.then((results) => {
for (const res of results) {
if (!res.err) console.log(res.journey)
}
})
.catch(console.error)
Related
manual-hafas-routing
– An experiment for manual routing via HAFAS.hafas-find-alternative-legs
– Given ahafas-client
journey, get alternatives for each leg from HAFAS.hafas-collect-departures-at
– Utility to collect departures, using any HAFAS client.
Contributing
If you have a question or need support using fetch-commute-from-hafas
, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.