项目作者: Jugendhackt

项目描述 :
Tokyo Metro data / 東京メトロのデータ
高级语言: Python
项目地址: git://github.com/Jugendhackt/tokyo-metro-data.git
创建时间: 2017-10-14T14:02:56Z
项目社区:https://github.com/Jugendhackt/tokyo-metro-data

开源协议:

下载


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:

  1. {
  2. "lines": {
  3. ...
  4. "A": {
  5. "name_en": "Asakusa Line",
  6. "name_jp": "浅草線"
  7. },
  8. "C": {
  9. "name_en": "Chiyoda Line",
  10. "name_jp": "千代田線"
  11. },
  12. ...
  13. },
  14. "stations": {
  15. ...
  16. "E27": {
  17. "connections": [
  18. {
  19. "distance": 0.6,
  20. "duration": -1,
  21. "target_id": "E26",
  22. "type": "ride",
  23. "type_id": 1
  24. },
  25. {
  26. "distance": 0.8,
  27. "duration": -1,
  28. "target_id": "E28",
  29. "type": "ride",
  30. "type_id": 1
  31. },
  32. {
  33. "distance": 0.0,
  34. "duration": -1,
  35. "target_id": "E01",
  36. "type": "walk",
  37. "type_id": 0
  38. },
  39. {
  40. "distance": 0.0,
  41. "duration": -1,
  42. "target_id": "S01",
  43. "type": "walk",
  44. "type_id": 0
  45. },
  46. {
  47. "distance": 0.0,
  48. "duration": -1,
  49. "target_id": "M08",
  50. "type": "walk",
  51. "type_id": 0
  52. }
  53. ],
  54. "name_en": "Shinjuku",
  55. "name_jp": "新宿"
  56. },
  57. ...
  58. },
  59. "transition_types": {
  60. "0": "walk",
  61. "1": "ride",
  62. "2": "ground"
  63. }
  64. }

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:

  1. import pandas as pd
  2. # Load csv file
  3. matrix_dist = pd.read_csv('matrix_dist.csv', index_col=0)
  4. # Show distance from A05 to A06 in km
  5. print(matrix_dist["A05"]["A06"])
  6. >>> 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