{"id":15592185,"url":"https://github.com/derhuerst/db-hafas-stations","last_synced_at":"2025-07-27T04:07:32.915Z","repository":{"id":66219441,"uuid":"137879589","full_name":"derhuerst/db-hafas-stations","owner":"derhuerst","description":"A list of most stations known by Deutsche Bahn, fetched from their APIs.","archived":false,"fork":false,"pushed_at":"2025-03-18T23:40:12.000Z","size":66,"stargazers_count":9,"open_issues_count":2,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-23T11:55:06.375Z","etag":null,"topics":["db","deutsche-bahn","railways","stations"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/derhuerst.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license-data.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"liberapay":"derhuerst","patreon":"derhuerst","github":"derhuerst"}},"created_at":"2018-06-19T11:00:48.000Z","updated_at":"2025-03-25T21:55:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"8d965223-362d-4fe4-9da7-6cbe581762c3","html_url":"https://github.com/derhuerst/db-hafas-stations","commit_stats":{"total_commits":30,"total_committers":1,"mean_commits":30.0,"dds":0.0,"last_synced_commit":"b192b1245514b753b5cfc12d004268b0b97961f3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/derhuerst/db-hafas-stations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fdb-hafas-stations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fdb-hafas-stations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fdb-hafas-stations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fdb-hafas-stations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derhuerst","download_url":"https://codeload.github.com/derhuerst/db-hafas-stations/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fdb-hafas-stations/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267298755,"owners_count":24065888,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["db","deutsche-bahn","railways","stations"],"created_at":"2024-10-02T23:57:35.657Z","updated_at":"2025-07-27T04:07:32.893Z","avatar_url":"https://github.com/derhuerst.png","language":"JavaScript","funding_links":["https://liberapay.com/derhuerst","https://patreon.com/derhuerst","https://github.com/sponsors/derhuerst"],"categories":[],"sub_categories":[],"readme":"# db-hafas-stations\n\n**All [*Deutsche Bahn* (DB)](https://en.wikipedia.org/wiki/Deutsche_Bahn) stations**, including local public transport (buses, trams...) stops,  currently about 290k. Returned by their [RIS::Stations](https://developers.deutschebahn.com/db-api-marketplace/apis/product/ris-stations) and [StaDa](https://developers.deutschebahn.com/db-api-marketplace/apis/product/stada) APIs (DB InfraGO, [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) and [OpenStreetMap Contributors](https://www.openstreetmap.org/copyright)). These use the same `evaNumbers` and names as the DB HAFAS that historically has been the source of this data.\n\n[![npm version](https://img.shields.io/npm/v/db-hafas-stations.svg)](https://www.npmjs.com/package/db-hafas-stations)\n![ISC-licensed](https://img.shields.io/github/license/derhuerst/db-hafas-stations.svg)\n![minimum Node.js version](https://img.shields.io/node/v/db-hafas-stations.svg)\n[![support me via GitHub Sponsors](https://img.shields.io/badge/support%20me-donate-fa7664.svg)](https://github.com/sponsors/derhuerst)\n[![chat with me on Twitter](https://img.shields.io/badge/chat%20with%20me-on%20Twitter-1da1f2.svg)](https://twitter.com/derhuerst)\n\n\n## Installation\n\n```shell\nnpm install db-hafas-stations\n```\n\n*Note:* This Git repo does not contain the data, but the npm package does.\n\n\n## Usage\n\n`readSimplifiedStations()` is an [async generator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function*) yielding [*Friendly Public Transport Format*](https://github.com/public-transport/friendly-public-transport-format) `station` and `stop` objects, read from `db-hafas-stations/data.ndjson` (~14mb).\n\n```js\nimport {\n\treadSimplifiedStations,\n\treadFullStations,\n} from 'db-hafas-stations'\n\nfor await const (station of readSimplifiedStations()) {\n\tconsole.log(station)\n}\n```\n\n```js\n{\n\ttype: 'station',\n\tid: '8000007',\n\tname: 'Alzey',\n\tweight: 73.1,\n\tlocation: {\n\t\ttype: 'location',\n\t\tlatitude: 49.7502,\n\t\tlongitude: 8.109749\n\t}\n}\n// …\n```\n\n`readFullStations()` is an async generator function yielding objects with more fields, read from `db-hafas-stations/full.ndjson` (~112mb).\n\n## Building\n\nYou need to subscribe to both the [RIS::Stations](https://developers.deutschebahn.com/db-api-marketplace/apis/product/ris-stations) and [StaDa](https://developers.deutschebahn.com/db-api-marketplace/apis/product/stada) API and set the corresponding environment variables `DB_CLIENT_ID` and  `DB_API_KEY` before running `npm run fetch` to fetch the data from the APIs (run carefully and not frequently, the quotas are very low!) and `npm run merge`.\n\n## Related\n\n- [`db-hafas-stations-autocomplete`](https://github.com/derhuerst/db-hafas-stations-autocomplete#db-stations-autocomplete) – Search for stations of DB (data from HAFAS).\n- [`db-stations`](https://github.com/derhuerst/db-stations#db-stations) – A collection of just the train stations of Deutsche Bahn, computed from open data.\n- [`hafas-find-stations`](https://github.com/derhuerst/hafas-find-stations) – Given a HAFAS client, find all stations in a bounding box.\n- [`hafas-discover-stations`](https://github.com/derhuerst/hafas-discover-stations#hafas-discover-stations) – Pass in a HAFAS client, discover stations by querying departures.\n- [`db-stops-search`](https://github.com/derhuerst/db-stops-search) – Search through all stops/stations in `db-hafas-stations`. Formats and imports the stops into a Meilisearch instance.\n\n\n## Contributing\n\nIf 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](https://github.com/derhuerst/db-hafas-stations/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderhuerst%2Fdb-hafas-stations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderhuerst%2Fdb-hafas-stations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderhuerst%2Fdb-hafas-stations/lists"}