{"id":15284679,"url":"https://github.com/juliuste/db-platforms","last_synced_at":"2025-04-12T23:43:56.793Z","repository":{"id":46225711,"uuid":"173442305","full_name":"juliuste/db-platforms","owner":"juliuste","description":"Deutsche Bahn platform information, enriched with OSM data.","archived":false,"fork":false,"pushed_at":"2021-11-05T11:36:10.000Z","size":770,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-02T06:16:24.355Z","etag":null,"topics":["library","public-transport","railway"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juliuste.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-02T11:58:24.000Z","updated_at":"2022-06-16T19:28:00.000Z","dependencies_parsed_at":"2022-08-31T02:41:37.718Z","dependency_job_id":null,"html_url":"https://github.com/juliuste/db-platforms","commit_stats":null,"previous_names":["juliuste/db-perrons"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fdb-platforms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fdb-platforms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fdb-platforms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fdb-platforms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliuste","download_url":"https://codeload.github.com/juliuste/db-platforms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647256,"owners_count":21139081,"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","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":["library","public-transport","railway"],"created_at":"2024-09-30T14:59:23.428Z","updated_at":"2025-04-12T23:43:56.770Z","avatar_url":"https://github.com/juliuste.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# db-platforms\n\nDeutsche Bahn platform information, enriched with OSM data.\n\nYou're invited to help, see the [definitions](#definitions), [data structure](#data-structure) and [contributing](#contributing) sections!\n\nUsing [this original dataset](https://data.deutschebahn.com/dataset/data-bahnsteig) provided by [Deutsche Bahn](https://www.bahn.de).\n\n[![npm version](https://img.shields.io/npm/v/db-platforms.svg)](https://www.npmjs.com/package/db-platforms)\n[![Build Status](https://travis-ci.org/juliuste/db-platforms.svg?branch=master)](https://travis-ci.org/juliuste/db-platforms)\n[![Greenkeeper badge](https://badges.greenkeeper.io/juliuste/db-platforms.svg)](https://greenkeeper.io/)\n[![license](https://img.shields.io/github/license/juliuste/db-platforms.svg?style=flat)](license)\n\n## Definitions\n\nSince the word *platform* is ambiguous in the English language (some people use it refering to the tracks at which trains depart while some people think of it as the place where you wait for your train, see also [here](https://en.wikipedia.org/wiki/Railway_platform#Identification)), we use the following terms in this readme:\n\n| term | definition | 🇫🇷 | 🇵🇱 | 🇩🇪 |\n| ---- | ---------- | -- | -- | -- |\n| **perron** | The area where you wait for your train, right next to the tracks | quai | peron | Bahnsteig |\n| **track** | Tracks (their numbers) are usually announced via speakers or visible on a departure board. There are often two tracks at one perron. | voie | tor | Gleis |\n\n## Installation and Usage\n\nIf you're using `JavaScript`, you can use the package by installing:\n\n```bash\nnpm install db-platforms\n```\n\n```js\nconst tracks = require('db-platforms')\n```\n\nThe module exposes a list of *tracks*. Tracks contain the following information:\n\n- Metadata for the specific track, e.g. id, name, long name.\n- ID of the track's station, you can use the [`db-stations`](https://github.com/derhuerst/db-stations) module to retrieve additional information.\n- The *perron* this track belongs to. Note that this information is extracted from the [Deutsche Bahn dataset mentioned above](https://data.deutschebahn.com/dataset/data-bahnsteig), which turns out to contain some errors in the mapping from tracks to perrons. This means that sometimes two tracks are shown to belong to the same perron while they actually don't. For this reason, it is probably better to - if available for that track - use OpenStreetMap information to determine if two tracks are located next to each other.\n- OpenStreetMap *stop position* and *platform* entities corresponding to that track. See also [*Why aren't OSM platforms tagged on perrons?*](#why-arent-osm-platforms-tagged-on-perrons).\n\n\n### Output sample\n\n```js\n[\n\t{\n\t\tid: '8000001:1',\n\t\tname: '1',\n\t\tlongName: 'Gleis 1',\n\t\tstation: '8000001',\n\t\tperron: {\n\t\t\tid: '8000001:B01',\n\t\t\tname: 'B01',\n\t\t\tstation: '8000001',\n\t\t\tlength: 168,\n\t\t\theight: 76\n\t\t},\n\t\tosmPlatform: { // null if not tagged yet\n\t\t\ttype: 'way',\n\t\t\tid: '33170523'\n\t\t},\n\t\tosmStopPosition: { // null if not tagged yet\n\t\t\ttype: 'node',\n\t\t\tid: '215971279'\n\t\t}\n\t},\n\t{\n\t\tid: '8000001:2',\n\t\tname: '2',\n\t\tlongName: 'Gleis 2',\n\t\tstation: '8000001',\n\t\tperron: {\n\t\t\tid: '8000001:B02',\n\t\t\tname: 'B02',\n\t\t\tstation: '8000001',\n\t\t\tlength: 387,\n\t\t\theight: 76\n\t\t},\n\t\tosmPlatform: { // null if not tagged yet\n\t\t\ttype: 'relation',\n\t\t\tid: '5151598'\n\t\t},\n\t\tosmStopPosition: { // null if not tagged yet\n\t\t\ttype: 'node',\n\t\t\tid: '215971391'\n\t\t\tnotUnique: true // only set in rare cases where multiple tracks are represented by the same stop positon, e.g. for tracks where you can exit a train on both sides\n\t\t}\n\t},\n\t// …\n]\n```\n\n## Data structure\n\nWe aim to associate the following OpenStreetMap entities with *tracks*.\n\n| type | association |\n| ---- | ----------- |\n| `osmStopPosition` | Point *on* a metal rail, mapped in OSM as a node with attribute `public_transport=stop_position`, sometimes has an attribute `ref` or `local_ref` containing the track number |\n| `osmPlatform` | Perron area or edge close to the rail, mapped in OSM as a way or relation (MultiPolygon) with attribute `public_transport=platform`, `railway=platform` or `railway=platform_edge`, sometimes has an attribute `ref` containing the numbers of adjacent tracks. |\n\n### Why aren't OSM platforms tagged on perrons\n\nEven though OpenStreetMap *platforms* and this module's *perrons* describe the same concept, we don't store OSM platform associations on *perrons*, but rather on individual *tracks*. This happens for the following reasons:\n\n1. As mentioned above, the [original Deutsche Bahn dataset](https://data.deutschebahn.com/dataset/data-bahnsteig) sometimes contains errors in the association of tracks to perrons, meaning that multiple tracks are tagged to be part of the same perron while actually being separated in the real world.\n2. Deciding where one perron ends and another begins is a very opinionated task. You could even argue that terminal stations like Leipzig main station only have one giant perron instead of many. Since OSM contributors and the people who created the Deutsche Bahn dataset often draw these lines differently, it makes sense not to couple the concept of OpenStreetMap *platforms* with DB *perrons*.\n3. OpenStreetMap knows the concept of *platform edges*, corresponding to the edge of a platform which is relevant for a specific track. These couldn't be associated with *perrons*, but can be mapped to *tracks*.\n\n### Files\n\nOpenStreetMap associations are stored in `osm-stop-positions.ndjson` and `osm-platforms.ndjson`, [ndjson](http://ndjson.org/) files which contain one record per row. All records are objects with the following keys (required).\n\n| key name | description | example |\n| -------- | ----------- | ------- |\n| `id` | Track id | `\"8011674:1\"` |\n| `osmType` | Type of the OSM entity, either `node`, `way` or `relation`. Always `node` for *stop positions* | `\"way\"` |\n| `osmId` | Id of the OSM entity, `undefined` if `broken=true` or `obsolete=true`. Note that OSM ids are not too stable, however this still seems to be the best way to associate data (for now). Additionally, tests that verify that ids are still valid and refering to public_transport entities are run on a daily basis. | `\"378453650\"` |\n| `stationName` | Name of the station. Note that this field is required, but won't ever be parsed, we just use it to make the dataset a bit more human-readable. | `\"Gorgast\"` |\n| `revised` | Some entries have been automatically fetched/guessed from tagged OSM nodes (`false`), while others have been manually inserted (`true`). This field is currently not exposed by the module, but can be used internally to monitor quality. | `true` |\n| `notUnique` | *Only for stop positions.* Usually, the tests will fail if one osm stop_position id is associated with multiple tracks. However, in some rare cases, e.g. for tracks where you can exit a train on both sides, you can allow an osm id to be added for multiple tracks by setting `notUnique=true`. | *not set* |\n\nPut together, our example would give us the following data row for `osm-platforms.ndjson`:\n\n```json\n{\"id\":\"8011674:1\",\"osmType\":\"way\",\"osmId\":\"378453650\",\"stationName\":\"Gorgast\",\"revised\":true}\n```\n\n#### Obsolete entries in the original dataset\n\nThe original dataset contains some old tracks/perrons that don't really exist at the time (e.g. tracks that will never be served, semi-demolished perrons, …). These are stored in `obsolete.ndjson` and will be filtered out in the module's build process.\n\n## Contributing\n\nIf you want to add information to the dataset, **[fork this repository](https://help.github.com/articles/fork-a-repo/), add information and finally [submit a pull request](https://help.github.com/articles/about-pull-requests/)**. If you don't know how any of this works, you can also just [open an issue](https://github.com/juliuste/db-platforms/issues) with the information you want to add in text form and I'll add it to the dataset for you. The same applies if you have found an error or want to change anything about the data structure.\n\nPlease note that by contributing to this project, you waive any copyright claims on the information you add.\n\nSee the [**todo list**](todo.md) for a list of stations that have not been (fully) covered yet.\n\n### CLI\n\nIf you want to contribute to this project, you can either add data to `osm-stop-positions.ndjson` and `osm-platforms.ndjson` manually or use the CLI as follows:\n\n1. Clone the repository (or your fork)\n\n```bash\ngit clone https://github.com/juliuste/db-platforms.git\n```\n\n2. Navigate to the repository root\n\n```bash\ncd db-platforms\n```\n\n3. Use the CLI to add entries to `osm-stop-positions.ndjson` and `osm-platforms.ndjson`\n\n```bash\n./build/bin/index # starts the cli\n./build/bin/index --help # shows the help menu\n./build/bin/index --auto-open # starts the CLI, opens OpenStreetMap around stations automatically (only on mac OS, using 'open' CLI)\n```\n\n## License\n\nThe original dataset was released as [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/), the crowdsourced database of OpenStreetMap associations is licensed as [CC0](https://creativecommons.org/publicdomain/zero/1.0/deed.de).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Fdb-platforms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliuste%2Fdb-platforms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Fdb-platforms/lists"}