Skip to content

Tokyo Metro data / 東京メトロのデータ

Notifications You must be signed in to change notification settings

se-linde/tokyo-metro-data

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub last commit GitHub contributors GitHub watchers GitHub stars

Tokyo Metro Data

Data detailing Tokyo's Metro network, derived from the line plan and signs as well as tokyometro.jp.

You can help by improving it!

Data formats

JSON based data

Stations.json contains all currently known information. This includes the stations names in english and japanese as well all connections departing a station. Distances are in kilometers (float) and durations in seconds (int).

The following should explain stations.json:

{
    "lines": {
        ...
        "A": {
            "name_en": "Asakusa Line",
            "name_jp": "浅草線"
        },
        "C": {
            "name_en": "Chiyoda Line",
            "name_jp": "千代田線"
        },
        ...
    },
    "stations": {
        ...
        "E27": {
            "connections": [
                {
                    "distance": 0.6,
                    "duration": -1,
                    "target_id": "E26",
                    "type": "ride",
                    "type_id": 1
                },
                {
                    "distance": 0.8,
                    "duration": -1,
                    "target_id": "E28",
                    "type": "ride",
                    "type_id": 1
                },
                {
                    "distance": 0.0,
                    "duration": -1,
                    "target_id": "E01",
                    "type": "walk",
                    "type_id": 0
                },
                {
                    "distance": 0.0,
                    "duration": -1,
                    "target_id": "S01",
                    "type": "walk",
                    "type_id": 0
                },
                {
                    "distance": 0.0,
                    "duration": -1,
                    "target_id": "M08",
                    "type": "walk",
                    "type_id": 0
                }
            ],
            "name_en": "Shinjuku",
            "name_jp": "新宿"
        },
        ...
    },
    "transition_types": {
        "0": "walk",
        "1": "ride",
        "2": "ground"
    }
}

Matrix based format

Other then Stations.json you can also use matrix_dist.csv or matrix_time.csv. These can easily be used with python. Here is a quick example:

import pandas as pd

# Load csv file
matrix_dist = pd.read_csv('matrix_dist.csv', index_col=0)

# Show distance from A05 to A06 in km
print(matrix_dist["A05"]["A06"])
>>> 0.7

Regenerate data files

You'll want to update Stations.json, matrix_dist.csv and matrix_time.csv after doing changes to the data directory. To update Stations.json simply run the following within the repo:

$ generator.py

To update the matrix files, run the following:

$ generator.py -m

For verbose output use

$ generator.py -m -v

Things to do

As of yet there are a few things missing:

  • Adding all japanese station names to stations_jap.csv
  • Replace duration with distance
  • Add distance (listed on wikipedia)
  • Add a transition like file for duration
  • General code cleanup in generator.py (maybe some progress output?)
  • Add real durations to trasitions.csv and lines.csv
  • Adding connections to non-metro transport systems (e.g. train stations or airports)

Contributors

You can add yourself here after contributing something!

Projects using this data

Feel free to add your project!

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/

About

Tokyo Metro data / 東京メトロのデータ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%