JSPM

zhv-de

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q27075F
  • License ISC

Lets you fetch the most up-to-date release of the german central public transport stop registry (Zentrales Haltestellenverzeichnis, ZHV).

Package Exports

  • zhv-de

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zhv-de) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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 as well as 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.

npm version Build Status license

Installation

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) as arguments and returns a Promise that will resolve in an object-mode stream of stops.

const zhv = require('zhv-de')
const user = '<your-opendata-oepnv.de-user-email>'
const password = '<your-opendata-oepnv.de-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):

{
    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.