https://github.com/juliuste/zhv-de
Lets you fetch the most up-to-date release of the german central public transport stop registry (Zentrales Haltestellenverzeichnis, ZHV).
https://github.com/juliuste/zhv-de
library public-transport
Last synced: 6 months ago
JSON representation
Lets you fetch the most up-to-date release of the german central public transport stop registry (Zentrales Haltestellenverzeichnis, ZHV).
- Host: GitHub
- URL: https://github.com/juliuste/zhv-de
- Owner: juliuste
- License: isc
- Created: 2019-02-19T10:14:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-09T06:13:21.000Z (about 2 years ago)
- Last Synced: 2025-03-18T16:55:45.854Z (over 1 year ago)
- Topics: library, public-transport
- Language: JavaScript
- Size: 113 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
README
# zhv-de
Fetch the most up-to-date release of the german central public transport stop registry (Zentrales Haltestellenverzeichnis, ZHV - available on [opendata-oepnv.de](https://www.opendata-oepnv.de/ht/de/organisation/delfi/startseite?tx_vrrkit_view%5Bdataset_name%5D=deutschlandweite-haltestellendaten&tx_vrrkit_view%5Baction%5D=details&tx_vrrkit_view%5Bcontroller%5D=View) as well as [zhv.wvigmbh.de](https://zhv.wvigmbh.de/)). Sadly, there is no static endpoint from which you could obtain this data (yet), you can use this small tool until they provide one.
[](https://www.npmjs.com/package/zhv-de)
[](https://travis-ci.org/juliuste/zhv-de)
[](license)
## Installation
```shell
npm install zhv-de
```
## Usage
The module exposes a single method which takes `user` and `password` (you can obtain those credentials for free [at the opendata-oepnv.de website](https://www.opendata-oepnv.de/ht/de/standards/registrierung)) as arguments and returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/promise) that will resolve in an object-mode stream of stops.
```js
const zhv = require('zhv-de')
const user = ''
const password = ''
const ndjson = require('ndjson') // we use this to transform objects to JSON to pipe to stdout
zhv(user, password)
.then(dataStream => dataStream.pipe(ndjson.stringify()).pipe(process.stdout))
.catch(console.error)
```
The objects emitted by the stream will look as follows (note that the keys start with a lowercase character instead of the uppercase variant used on the ZHV website):
```js
{
seqNo: '0',
type: 'S',
dHID: 'de:07334:1714',
parent: 'de:07334:1714',
name: 'Wörth Alte Bahnmeisterei',
latitude: 49.048672,
longitude: 8.266324,
municipalityCode: '07334501',
municipality: 'Wörth am Rhein',
districtCode: null,
district: null,
condition: 'Served',
state: undefined,
description: undefined,
authority: 'NVBW'
}
```
## Contributing
If you found a bug or want to propose a feature, feel free to visit [the issues page](https://github.com/juliuste/zhv-de/issues).