An open API service indexing awesome lists of open source software.

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

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": ""
}
```