enzet / metro

Wikidata transport systems parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Metro

Wikidata parser for transport networks.

Install

Requirements: Python 3.9.

pip install .

Example run

To parse Prague metro system one should specify system Wikidata item (Q190271 for Prague Metro) and arbitrary station Wikidata item (Q1877386 for Florenc metro station).

metro --system 190271 --station 1877386

Output

Result will be in out/metro.json file with the following structure:

{
    "id": "<TEXT IDENTIFIER>",
    "stations": ["<STATION STRUCTURE>"],
    "lines": ["<LINE STRUCTURE>"]
}

Station structure

{
    "id": "<LINE IDENTIFIER>/<STATION SHORT IDENTIFIER>",
    "line": "<LINE IDENTIFIER>",
    "names": {
        "<LANGUAGE>": "<NAME>"
    },
    "open_time": "",
    "geo_positions": ["<LATITUDE>", "<LONGITUDE>"],
    "connections": [
        {
            "to": "<OTHER STATION IDENTIFIER>",
            "type": "<CONNECTION TYPE>"
        }
    ],
    "site_links": [
        {
            "<SITE>": "<PAGE NAME>"
        }
    ]
}

Line structure

{
    "id": "<LINE IDENTIFIER>/<STATION SHORT IDENTIFIER>",
    "names": {
        "<LANGUAGE>": "<NAME>"
    },
    "color": "<LINE COLOR>"
}

About

Wikidata transport systems parser

License:MIT License


Languages

Language:Python 98.8%Language:Shell 1.2%