https://github.com/enzet/wikidata-transport-parser
Wikidata transport systems parser
https://github.com/enzet/wikidata-transport-parser
parser python transport transportation-network wikidata
Last synced: 12 months ago
JSON representation
Wikidata transport systems parser
- Host: GitHub
- URL: https://github.com/enzet/wikidata-transport-parser
- Owner: enzet
- License: mit
- Created: 2022-09-16T07:19:55.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-27T20:24:51.000Z (about 1 year ago)
- Last Synced: 2025-05-27T21:30:20.891Z (about 1 year ago)
- Topics: parser, python, transport, transportation-network, wikidata
- Language: Python
- Homepage:
- Size: 48.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Transport Network Parser for Wikidata
A [Wikidata](https://wikidata.org) parser for transport networks.
## Installation
Requirements: Python 3.9 or higher.
```shell
pip install .
```
## Wikidata Parsing
The algorithm takes as input a Wikidata identifier of an arbitrary transport
station and a Wikidata identifier of the transport system. The algorithm will
recursively parse the network structure.
## Example Run
To parse the Prague metro system, you need to specify the system's Wikidata item
([Q190271](https://www.wikidata.org/wiki/Q190271) for Prague Metro) and
any station's Wikidata item
([Q1877386](https://www.wikidata.org/wiki/Q1877386) for Florenc metro station).
```shell
metro --system 190271 --station 1877386
```
## Output
The result will be saved in the `out/metro.json` file with the following structure:
```json
{
"id": "",
"stations": [""],
"lines": [""]
}
```
### Station Structure
```json
{
"id": "/",
"line": "",
"names": {
"": ""
},
"open_time": "",
"geo_positions": ["", ""],
"connections": [
{
"to": "",
"type": ""
}
],
"site_links": [
{
"": ""
}
]
}
```
### Line Structure
```json
{
"id": "/",
"names": {
"": ""
},
"color": ""
}
```