Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
PythonではじめるGTFS
Search
Satoshi Gachi Fujimoto
February 12, 2020
Technology
1.2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PythonではじめるGTFS
熊本GTFS-JP活用勉強会 vol.1の資料です。
https://kumamcn.connpass.com/event/164026/
Satoshi Gachi Fujimoto
February 12, 2020
More Decks by Satoshi Gachi Fujimoto
See All by Satoshi Gachi Fujimoto
忘年会LT(2025)
satoshirobatofujimoto
0
69
バスあと何分ミニサイネージ
satoshirobatofujimoto
0
150
高専で制御を、大学でセンシングを学び、次は脳みそ
satoshirobatofujimoto
0
340
画像生成AIを使って勝負しよう
satoshirobatofujimoto
1
190
ガチマナ会 vol.1
satoshirobatofujimoto
0
290
画像生成AIを使って勝負しよう
satoshirobatofujimoto
0
350
画像からプロンプトを考えて最も似ている画像を生成した人が勝ちのゲーム@AIミーティング
satoshirobatofujimoto
0
240
VPS研究者が語る”VPS概論”
satoshirobatofujimoto
0
510
画像からプロンプトを考えて最も似ている画像を生成した人が勝ちのゲーム
satoshirobatofujimoto
0
260
Other Decks in Technology
See All in Technology
おい、エージェントを使って終わらせろ
nwiizo
0
230
積み重なった技術負債への挑戦 〜初手としての全社ゴト化〜
techtekt
PRO
0
1.2k
MCPをつなげて作る組織横断のAIエージェント基盤(の開発工程)
tsubakimoto_s
0
130
日経電子版を支えていく Kasane Design System/fec_fukuoka
nikkei_engineer_recruiting
0
1.5k
技術的負債から考える、AI時代のエンジニアリング投資 — ビズリーチの技術的負債と向き合った経験から、変更し続けられるソフトウェアを考える/ technical-debt-con2026
visional_engineering_and_design
3
2.9k
AIネイティブプロダクトで顧客価値を最大化するプロダクトエンジニアとFDEの協働
righttouch
PRO
0
310
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
190
GoにおけるFFIのこれまでとこれから
goccy
5
3.3k
作品が生態系になった ─ Mini Tokyo 3D から世界へ
nagix
0
190
登壇の自信を奪う3匹のオバケ / 3 Ghosts That Rob You of Your Confidence in Public Speaking
pauli
8
910
安心して変更できるWebフロントエンドの作り方
pirosikick
4
2.5k
AIによるクリエイティブ生成を行う上での試行錯誤
plaidtech
PRO
0
140
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
1.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Navigating Team Friction
lara
192
16k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
Agile that works and the tools we love
rasmusluckow
331
22k
The Language of Interfaces
destraynor
162
27k
Amusing Abliteration
ianozsvald
1
300
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.9k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Optimizing for Happiness
mojombo
378
71k
Transcript
2020/02/12 熊本GTFS-JP活用勉強会 vol.1 PythonではじめるGTFS
自己紹介 ガチ本 です co-founder KumaMCN ナレッジコミュニケーション R&D戦略チーム AWS ML コンピテンシーパートナー
Microsoft Mixed Reality Partner CV / SLAM / WHILL / Python satoshi.gachi.fujimoto @sotongshi
Pythonでサーマルプリンタの印刷をするほどガチ
• 標準的なバス情報フォーマットとは • 熊本のオープンデータ • GTFS-JP相関図 • CSV形式とJSON形式 • データの読み取り
• 全部あげときます アジェンダ
標準的なバス情報フォーマットとは[1] • バス事業者と経路検索等の情報利用者との情報受け渡しのための共通フォーマット • 静的データ「GTFS-JP」と動的データ「GTFSリアルタイム」の2種類 [1] はじめよう︕「標準的なバス情報フォーマット」 http://www.mlit.go.jp/common/001283238.pdf 区分 フォーマット名
対象とする情報 ファイル形式 静的データ GTFS-JP 停留所、路線、便、時刻表、運賃 など csvをzipで圧縮 動的データ GTFSリアルタイム 遅延、到着予測、車両位置、運行情報 など Protocol Buffers
熊本のオープンデータ • バスきたくまさんの静的データ[2] • 産交バス、熊本電鉄バス、熊本バス、熊本 都市バスの4種類 • ファイル数は12個 • csv形式で書かれている
ファイル名 主な情報 必須 agency.txt 事業者情報 ✔ agency_jp.txt 事業者追加情報 calendar.txt 運行区分情報 ✔ calendar_dates.txt 運行日情報 feed_info.txt 提供情報 ✔ office_jp.txt 営業所情報 routes.txt 経路情報 ✔ routes_jp.txt 経路追加情報 stop_times.txt 通過時刻情報 ✔ stops.txt 停留所・標柱情報 ✔ translations.txt 翻訳情報 ✔ trips.txt 便情報 ✔ [2] バスきたくまさん(Bus-Vision) https://km.bus-vision.jp/kumamoto/view/opendataKuma.html
GTFS-JP相関図[3] [3] 静的バス情報フォーマット(GTFS-JP)仕様書 (第 2 版) https://www.mlit.go.jp/common/001283244.pdf
GTFS-JP相関図[3] [3] 静的バス情報フォーマット(GTFS-JP)仕様書 (第 2 版) https://www.mlit.go.jp/common/001283244.pdf
CSV形式とJSON形式 • CSV形式 • カンマ区切りのテキストファイル形式 • JSON形式 • 人間にとっても機械にとっても読み書きが容易な形式 •
Pythonでいうリストや辞書型 • APIのデータのやり取りに用いられる形式 "agency_id","agency_name","agency_url","agency_timezone","agency_lang","agency_phone","agency_fare_url“ "9330001006723","産交バス","https://www.kyusanko.co.jp/","Asia/Tokyo","ja","0963258243", [ { 'agency_id': '9330001006723’, 'agency_name': '産交バス’, 'agency_url': 'https://www.kyusanko.co.jp/’, 'agency_timezone': 'Asia/Tokyo’, 'agency_lang': 'ja’, 'agency_phone': '0963258243’, 'agency_fare_url': ‘’ } ]
データの読み取り import csv def read_gtfs(filename): with open(filename, 'r', encoding="utf-8") as
f: reader = csv.reader(f) data = [] for row in reader: data.append(row) result = [] for d in data[1:]: json_data = dict(zip(data[0], d)) result.append(json_data) return result
データの読み取り dirname = "sankobus/" filename = "agency.txt" data = read_gtfs(dirname
+ filename) print(data) for agency in data: print(agency["agency_id"]) print(agency["agency_name"]) print(agency["agency_url"]) print(agency["agency_timezone"]) print(agency["agency_lang"]) print(agency["agency_phone"]) print(agency["agency_fare_url"])
実行結果 print(data) [{'agency_id': '9330001006723', 'agency_name': '産交バス', 'agency_url': 'https://www.kyusanko.co.jp/', 'agency_timezone': 'Asia/Tokyo',
'agency_lang': 'ja', 'agency_phone': '0963258243', 'agency_fare_url': ‘’}] print(agency["agency_id"]) 9330001006723 print(agency["agency_name"]) 産交バス print(agency["agency_url"]) https://www.kyusanko.co.jp/ print(agency["agency_timezone"]) Asia/Tokyo print(agency["agency_lang"]) ja print(agency["agency_phone"]) 0963258243 print(agency["agency_fare_url"])
全部あげときます print(agency["agency_id"]) print(agency["agency_name"]) print(agency["agency_url"]) print(agency["agency_timezone"]) print(agency["agency_lang"]) print(agency["agency_phone"]) print(agency["agency_fare_url"]) print(agency_jp["agency_id"]) print(agency_jp["agency_official_name"])
print(agency_jp["agency_zip_number"]) print(agency_jp["agency_address"]) print(agency_jp["agency_president_pos"]) print(agency_jp["agency_president_name"])
全部あげときます print(calendar["service_id"]) print(calendar["monday"]) print(calendar["tuesday"]) print(calendar["wednesday"]) print(calendar["thursday"]) print(calendar["friday"]) print(calendar["saturday"]) print(calendar["sunday"]) print(calendar["start_date"])
print(calendar["end_date"]) print(calendar_dates["service_id"]) print(calendar_dates["date"]) print(calendar_dates["exception_type"])
全部あげときます print(feed_info["feed_publisher_name"]) print(feed_info["feed_publisher_url"]) print(feed_info["feed_lang"]) print(feed_info["feed_start_date"]) print(feed_info["feed_end_date"]) print(feed_info["feed_version"]) print(office_jp["office_id"]) print(office_jp["office_name"]) print(office_jp["office_url"])
print(office_jp["office_phone"])
全部あげときます print(routes_jp["route_id"]) print(routes_jp["route_update_date"]) print(routes_jp["origin_stop"]) print(routes_jp["via_stop"]) print(routes_jp["destination_stop"]) print(routes["route_id"]) print(routes["agency_id"]) print(routes["route_short_name"]) print(routes["route_long_name"])
print(routes["route_desc"]) print(routes["route_type"]) print(routes["route_url"]) print(routes["route_color"]) print(routes["route_text_color"]) print(routes["jp_parent_route_id"])
全部あげときます print(stop_times["trip_id"]) print(stop_times["arrival_time"]) print(stop_times["departure_time"]) print(stop_times["stop_id"]) print(stop_times["stop_sequence"]) print(stop_times["stop_headsign"]) print(stop_times["pickup_type"]) print(stop_times["drop_off_type"]) print(stop_times["shape_dist_traveled"])
全部あげときます print(stops["stop_id"]) print(stops["stop_code"]) print(stops["stop_name"]) print(stops["stop_desc"]) print(stops["stop_lat"]) print(stops["stop_lon"]) print(stops["zone_id"]) print(stops["stop_url"]) print(stops["location_type"])
print(stops["parent_station"]) print(stops["stop_timezone"]) print(stops["wheelchair_boarding"]) print(stops["platform_code"])
全部あげときます print(translations["trans_id"]) print(translations["lang"]) print(translations["translation"]) print(trips["route_id"]) print(trips["service_id"]) print(trips["trip_id"]) print(trips["trip_headsign"]) print(trips["trip_short_name"]) print(trips["direction_id"])
print(trips["block_id"]) print(trips["shape_id"]) print(trips["jp_trip_desc"]) print(trips["jp_trip_desc_symbol"]) print(trips["jp_office_id"])
Python はじめよう!
イベント 日時 2020/3/4(水) 19:00-21:00 場所 えきまえスペース(熊本駅白川口前) 参加費 500円(会場代) URL https://kumamcn.connpass.com/event/166426/
日時 2020/4/6(月) 午後 場所 未定 参加費 未定 URL https://hololens.connpass.com/
ご清聴ありがとうございました