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
68
バスあと何分ミニサイネージ
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
Snowflakeで実現する全社横断の顧客の声(VOC)分析・活用基盤@Snowflake World Tour Tokyo 2026
yuto16
0
160
スクラムで身についていた動き方を、XPで捉え直してみた
codmoninc
PRO
1
350
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
260
【視聴者参加型!】AWSセキュリティアンチパターンクイズ
syoshie
1
490
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
160
薬剤師(ドメインエキスパート)と一緒に育てる薬局向けAIアシスタント
kakehashi
PRO
2
140
OpenTelemetryのメトリクスをCloudWatchに送ってPromQLで見てみた
ota1022
0
120
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
600
家のリアーキテクト・リファクタリング
suguruooki
0
110
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
260
Omarchy Quattro の日本語設定周り
simosako
2
140
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
Featured
See All Featured
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
600
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
490
Darren the Foodie - Storyboard
khoart
PRO
3
3.9k
Navigating Team Friction
lara
192
16k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Raft: Consensus for Rubyists
vanstee
141
7.7k
Practical Orchestrator
shlominoach
191
12k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
990
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
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/
ご清聴ありがとうございました