derhuerst / db-hafas-stations

A list of DB stations, taken from HAFAS.
https://github.com/derhuerst/db-hafas-stations#db-hafas-stations
ISC License
5 stars 2 forks source link
db deutsche-bahn stations

db-hafas-stations

All Deutsche Bahn (DB) stations returned by their HAFAS API, currently about 299k.

npm version ISC-licensed minimum Node.js version support me via GitHub Sponsors chat with me on Twitter

Installation

npm install db-hafas-stations

Note: This Git repo does not contain the data, but the npm package does.

Usage

stations() returns a readable stream in object mode, emitting Friendly Public Transport Format station and stop objects read from db-hafas-stations/data.ndjson (~13mb).

const stations = require('db-hafas-stations')

stations()
.on('data', console.log)
.on('error', console.error)
{
    type: 'station',
    id: '8000007',
    name: 'Alzey',
    weight: 73.1,
    location: {
        type: 'location',
        latitude: 49.7502,
        longitude: 8.109749
    }
}
// …

stations.full() returns a with more fields per object, read from db-hafas-stations/full.ndjson (~120mb).

Related

Contributing

If you have a question or have difficulties using db-hafas-stations, 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.