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
70
バスあと何分ミニサイネージ
satoshirobatofujimoto
0
150
高専で制御を、大学でセンシングを学び、次は脳みそ
satoshirobatofujimoto
0
340
画像生成AIを使って勝負しよう
satoshirobatofujimoto
1
190
ガチマナ会 vol.1
satoshirobatofujimoto
0
300
画像生成AIを使って勝負しよう
satoshirobatofujimoto
0
350
画像からプロンプトを考えて最も似ている画像を生成した人が勝ちのゲーム@AIミーティング
satoshirobatofujimoto
0
240
VPS研究者が語る”VPS概論”
satoshirobatofujimoto
0
520
画像からプロンプトを考えて最も似ている画像を生成した人が勝ちのゲーム
satoshirobatofujimoto
0
260
Other Decks in Technology
See All in Technology
今こそ知りたいAmplifyGen2
mkdev10
2
160
分析AIエージェントを育てる、動く環境を育てる
codatum
0
330
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
3
4.7k
ビジネスを止めない技術的負債の返済のための戦略とその手法 - 技術的負債と向き合う / Complexity and Simplicity
soudai
PRO
3
660
SREでアラート疲れを 解決しよう!
kairim0
1
210
ハードウェアコンペでもAI駆動開発が進んでいる話
iotengineer22
0
400
Meet AgentCore Identity Consent Portal
hironobuiga
3
190
味覇で作るパスタが美味い - 20261001_yabaubuki.dev
livesense
PRO
0
100
自作バイナリを動かす「入口」8選
puhitaku
1
720
More Freedom on the Same Shared GPU Cluster: A Small Team’s Experience with vCluster
nttcom
0
140
今さら理解するウェブフォントver.2026
takanorip
2
130
DevelopersIO 2026 知識の地図を描く ─ オントロジーとは何か?
ishikawa_satoru
1
290
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
The Curious Case for Waylosing
cassininazir
1
560
Designing for humans not robots
tammielis
254
26k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
480
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
420
A Tale of Four Properties
chriscoyier
163
24k
Navigating Weather and Climate Data
rabernat
0
550
Build your cross-platform service in a week with App Engine
jlugia
234
19k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
590
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
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/
ご清聴ありがとうございました