Published June 7, 2026 | Version v4.3

R Code for Regional Analysis: GTFS Data Generation, Automated GeoJSON Conversion, and Instant Animation Visualization 地域分析のためのRコード:GTFS独自生成、静的GTFSからのGeoJSON自動変換と即時アニメーション可視化

  • 1. ROR icon Nanzan University

Description

地域分析のためのRコード: GTFS独自生成、静的GTFSからのGeoJSON自動変換と即時アニメーション可視化

概要(Description)

Notice

The paper associated with this research/dataset is available on SSRN. The latest version of the preprint, which includes corrected names of the analyzed municipalities and other textual updates, can be accessed here: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=6925698

V4.3: 阿久比町アグピー号のGTFS生成(Rコード)

従来、shapes.txtの作成部分のみPythonコードに依存していたが、これをR環境へ完全移植し、単一言語の一元的な生成パイプラインを確立した。公的にWebで公開されているバス停データ及び時刻表データと国土数値情報のバスルートデータを統合し、R上でルート線形を自動導出することで、シミュレーションに不可欠な正確なGTFSの作成」(初期版のデータ欠損や空間的乖離の解消)を目指している。Rコードへの移植に伴い、shapes.txtが的確に生成されることを筆者自身で動作確認済みである。開発プロセスではClaude 3.5 SonnetとGemini 1.5 Proを併用し、shapes.txtの一定のデータ整合性は筆者が検証した。専門インフラは不要であり、Rの標準環境のみでGTFS生成と動的可視化が可能である。

V4.2: 阿久比町アグピー号のGTFS生成(パイソンコード)

本リポジトリの目的は、愛知県阿久比町のコミュニティバス「アグピー号」の運行データを国際標準規格であるGTFS(General Transit Feed Specification)形式へ変換し、空間的な線形データ(shapes.txt)を付加した研究用データセット生成である(Version 4.2)。本データは、公的にWebで公開されているバス停データと時刻表データと国土数値情報のバスルートデータを統合し、Pythonアルゴリズムを用いて運行便ごとのルート線形を自動導出したものであり、V4.0で独自生成したGTFSデータに欠けていたシミュレーション用の空間精度を補完し、GTFSデータに反映させた(shapes.txt)。本データセットの生成プロセスにおいては、Anthropic社のClaude 3.5 SonnetおよびGoogleのGemini 1.5 Proを併用し、空間幾何学ロジックの構築やコード実装を支援させることで効率化を図った。生成されたデータおよび実装コードの最終的な論理整合性については研究者自身が検証し、今のところ一定の妥当性を確認している。このより正確なGTFS作成についてはClaudeの機能が有効で、generate_shapes.pyは事後的に、生成の機能を再現できるよう作成したパイソンコードである(その動作は未確認。)。なお、本データは研究用プロトタイプであり、実用化に向けた継続的な精度検証を前提とした実験的成果物として公開する。 4市町5事業者のデモ https://moteki.shinyapps.io/transit_chita5/

阿久比町GTSFデータ作成の元データ

1. バージョン4.1: 時空間GeoPackageの統合

今回のアップデートでは、公式GTFSデータの公開・更新が実質的に停止している阿久比町コミュニティバスを網羅し、4自治体にまたがる広域バス運行シミュレーションを実現した。このシミュレーターの基盤となる時空間GeoPackageデータを、生のデータソースから一括生成する専用の変換コードを新たに作成した。同期化された運行ダイヤ情報は、生成された単一のGeoPackageファイル内にある点(停留所)レイヤーの属性テーブルへと直接記録されている。これに加え、ルート線形データ(shapes)の欠落を視覚的に克服するパルス明滅型(点描仕様)の表現を採用したことで、起動時における生のGTFS処理負荷(オーバーヘッド)が排除され、公式のGTFSが提供されていない地域も統一的に一貫性のあるWebシミュレーターを、制限のあるクラウド環境上でも軽快に起動することが可能となった。

2. QGISフィールド計算機を用いた時系列フィールドの生成

GTFSデータ等から出力したgpkgファイルは、QGIS等でも表示できる。時間軸に連動したアニメーションを開始するには、QGISの「フィールド計算機(そろばんのアイコン)」を開き、新しいタイムスタンプ属性を作成する。この設定におけるポイントは、「新しいフィールドをつくる」にチェックを入れ、出力フィールド名に「bus_time」と入力し、出力するフィールド型を「日時 (Date/Time)」に指定することである。そして、式のボックスに数式 to_datetime('2026-06-06 00:00:00') + make_interval(minutes:= "time_min") を正確に入力する必要がある。この重要な数式がシミュレーション全体の技術的エンジンとして機能し、整数ベースの経過分数を、GISのネイティブな空間タイムラインへと動的に変換する。

本プログラムの目的および概要(V3.8-3.9機能)

本プログラム(最新V3.8)は、入手容易な「静的GTFS(Static GTFS)データ」を作業フォルダに投入するだけで、広域公共交通ネットワークの運行ダイナミズムを誰もが即座に再現・視覚化できる、極めて実用的で扱いやすい軽量データサイエンス・パッケージである

最大の特徴は、複雑なデータ処理をすべて裏側に隠し、以下のプロセスを全自動化した点にある

  • 全自動コンバート機能: フォルダ内のGTFSデータから、路線網の「線データ」と、1分刻みのバス位置の「点データ」という2つの標準GeoJSONファイルを全自動で生成

  • 高機能スムーズ・ビューワー: 生成されたGeoJSONをR(Shiny/Leaflet)に読み込ませるだけで、バスオブジェクトが道路上を滑らかに走り出す動的シミュレーターを同梱

  • 時差バグの根絶: R環境で頻発しやすい「時間が9時間ズレて車両が画面から消失する時差バグ」を防止

本システムは、高価なリアルタイムデータ(GTFS-RT)インフラに依存せず、国内標準規格「GTFS-JP」等の既存データのみで、主要駅や病院などの結節点における接続性やルート間の関係を客観的に検証できる、政策科学の実践的な軽量プラットフォームとして機能する 。本コードは、Google Geminiのコード支援を用い、実装した。

Web上でのShinyアプリの公開(試用版)

本研究で構築したデータセットおよび前処理パイプラインの有用性を実証するため、ブラウザ上で動作するインタラクティブな時空間シミュレーター(デモ版)https://policyevaluation.net/transit/  このデモ版は契約するサーバーの都合で、一時的にアプリへアクセスできなくなる(接続エラー画面が表示される)可能性がある。その場合は、本リポジトリからデータおよびコードをローカル環境にダウンロードして実行してください。

別サーバーでのデモ https://moteki.shinyapps.io/transit/

(260527追記)V3.9でGTFSや運行情報データを独自に生成した阿久比町「アグピー号」の運行シミレーションも含めた知多地域の3市町のシミュレーターをデモ公開しました。(260528追記)オレンジラインのピアゴのあたりから川に沿って西に路線が延びている部分に、路線が正確でない箇所を確認し、正確に描く方法を検討しています。

V4.0更新 知多半島の4事業者版公開(東浦町、知多市、大府市)

(260530追記)GTFSの提供している大府市のふれあいバスを対象に含めた知多半島の4事業者版を公開しました。https://moteki.shinyapps.io/transit_chita/(260530追記2)4事業者版のレンタルサーバー環境での稼働もコード変更で実現しました。https://www.policyevaluation.net/transit_chita/ *この後者のサーバーは仕様変更で、現在不安定。

V3.9へのアップデート(時刻表データ・バス停データからのGTFSの生成)

本研究で構築したV3.8までのフレームワークでは、静的GTFSデータからGeoJSONへの自動変換および可視化プロセスの基盤を確立した。

続くV3.9においては、その成果をさらに発展させた。今回分析対象とする阿久比町は、これまでの分析対象であった東浦町の南側に隣接する地域である。この阿久比町において、公式GTFSデータの公開が終了するという課題が発生したため、独自のデータ再構築プロセスを実装することで、持続可能な分析基盤を再構築した。具体的には、阿久比町の公式ウェブサイト上で公開されているバス停情報および時刻表情報(https://www.town.agui.lg.jp/0000005531.html, https://www.town.agui.lg.jp/0000005530.html)を直接のソースとし、これらを標準的なGTFSフォーマットへ変換する専用コンバーターを開発した。

これにより、公式データの消失後も地域公共交通の動態分析を継続可能とし、いわば『デジタル公共交通データの再生』の実現を目指している。さらに、系統ごとのオフセット処理を最適化することで、路線図の重なりを回避し、より直感的に運行系統を識別できる視覚的表現を実装した。本バージョンにより、分析環境としての再現性と精度が大幅に向上し、東浦町との比較分析など、地域間を跨いだ公共交通の現状をより客観的に提示可能な分析パッケージへと進化させた。

1. 先行事例(gtfs-box等)との違いおよび本プログラムの独自性

GTFSデータを活用した動的公共交通シミュレーションという点において、本プログラムは優れた先行事例である「gtfs-box」(https://github.com/nagix/gtfs-box)等と共通の着想を持つが 、実務・教育現場における「圧倒的な簡便性」とデータサイエンス環境への最適化において、決定的な優位性を有する

(1) 圧倒的な簡便性(インフラフリー・単一スクリプト完結)

JavaScriptやWebサーバーの高度な知識・環境構築を必要とする一般的なWebアプリケーションに対し、本プログラムは必要なGTFSテキストファイルを作業フォルダに配置し、Rスクリプトを実行するだけで即座に動作する 。専門のインフラや複雑な設定を一切排除したこの簡便性は、自治体の交通政策実務や、大学のワークショップ等の限られた時間内でツールを即座に導入・活用する上で決定的な優位性となる

(2) データサイエンス環境(R言語/Shiny)へのダイレクトな最適化

地域分析や空間統計(GIS)の標準言語であるR(shiny, leaflet, tidyverse, sf)のみで完結しているため、利用者は内部ロジック(線形補間など)を直接確認・編集できる 。さらに、出力された車両動態データをそのままRでの統計解析や他の地域分析ロジックへとシームレスに結合・拡張させることが可能である

(3) 地域公共交通網全体の網羅的な一括可視化(常時色分け描画)

単一の事業者や特定の路線のみを個別に切り取る既存アプローチとは異なり、アプリ起動時から全系統の路線網および動的に移動するバスの車両オブジェクト(点マーカー)自体が、それぞれの運行系統に対応した固有のルートカラーで常時描画される 。これにより、複数の系統や車両が街の中でどのように重複し、どこで結節やすれ違いを行っているかという「地域全体の交通デザイン」を高次元な政策的視点から直感的に把握できる

2. 国際的文脈における位置づけ:動的アクセシビリティ評価の設計思想

本コードの設計思想は、国際的文脈において、英国ウェールズの研究グループ(Webb et al., 2025)が提案した動的なアクセシビリティ評価ツールの設計思想と強く通底するものである

Webb, L., Langford, M., Higgs, G., & Berry, R. (2025). The design of a dynamic web-based solution to measure accessibility via public transport under different travel scenarios. Case Studies on Transport Policy, 21, 101561.

Webb et al.(2025)は、バス路線の廃止・新設や事業者の撤退といった移動シナリオが公共交通のアクセシビリティに与える影響を、政策立案者が動的に分析・比較できるインタラクティブなWeb-GISツールを提案している

本コードの独自性:複雑なインフラを排した「簡便な実装」

バス停の配置やルートの変更が地域に与える影響をシミュレーションし、科学的政策形成(EBPM)に資する視覚的根拠を得るという目的はWebbらの論文と軌を一にしている 。しかし、実装アプローチにおいては以下の決定的な違いを有する

  • インフラフリーの追求: WebbらのシステムがバックエンドにPostgreSQL/PostGIS、OpenTripPlanner、GeoServer、PHPといった多層的なサーバーサイド・インフラを要求する「重厚な設計」であるのに対し、本コードはR言語の標準的な環境(デスクトップ・ノートPC)のみで動作する「簡便な実装」を追求している

  • 現場への適応性: 重厚なインフラを排したことで、専門的なITスキルのない行政担当者や、制約の多いワークショップ現場、プログラミング教育の現場においても、GTFSデータさえあれば即座にシナリオ検討を開始できる高い機動性を確保している

3. 関連バージョンの案内

  • Version 2.0(静的流線図マッピング版): GTFS-JPデータを用いた、よりシンプルで静的な可視化(インフラの流線図マッピングなど)を希望される利用者のためのレガシー版

    Moteki, Y. (2026). R Code for Regional Analysis: Interactive Flow Mapping of Public Transport Infrastructure using Leaflet and GTFS Data (v2.0). Zenodo. https://doi.org/10.5281/zenodo.20116368

  • GTFS-Realtime 統合フレームワーク(関連リポジトリ): 実際のリアルタイムデータ(GTFS-Realtime)フィードを活用した統合的な可視化フレームワーク。都営バス、知多市「あいあいバス」、広島電鉄バスなどの具体的な実装事例を確認したい利用者向け

    Moteki, Y. (2026). R Code for Regional Analysis: Integrated GTFS-Static and Realtime Public Transit Data Visualization Framework (v2.0). Zenodo. https://doi.org/10.5281/zenodo.20278677 2. データ出典および作成者

4. 学術的・実務的価値

本スクリプトにおける空間的な正確性およびルーティング(経路生成)ロジックは、東浦町地域公共交通会議が発行する『楽しい公共交通のはじめかた』に掲載された「公共交通ざっくりマップ」と照合・検証済みである(初期のV1.0開発段階においてデータ整合性を確認)。

本パッケージは、他の地方自治体や交通研究者、そして学生が「手元にある生のGTFSフィードを即座に地図へと変換し、自らの目で実際の運行パターンを実証的に理解・検討するための、極めて汎用性の高い即用型(ターンキー)のベースライン・プラットフォームを提供する。さらに、本アプリケーションで描写される各路線のレンダリングカラー(描画色)は、生のGTFSデータ内部に埋め込まれたカラーコード(16進数カラーコード)から直接パース(抽出)されており、公式の「公共交通ざっくりマップ」の配色と完全に同期・連動している。

5. 注意事項:アプリケーションの安全な停止とRセッションの再起動

コード修正時、変更内容を画面に確実に反映させ、メモリ残存による誤作動を防ぐためには、「プログラムの停止」と「Rセッションの再起動」の2ステップを踏むのが最も安全である。

(1) 稼働中アプリケーションの停止(コンソールの解放)

コードを書き換える前に、必ずRStudioのコンソール右上(またはViewer枠内)にある「赤い停止マーク(ストップボタン)」を押し、アプリを明示的に停止させる。

ブラウザのウィンドウを閉じるだけでは、裏側でローカルウェブサーバーのプロセスが未終了のまま残存し、次回起動時にポート(通信の接続口)の衝突エラーを起こすリスクがある。停止マークを押すことでプロセスが安全にシャットダウンされ、占有されていたコンソールが解放される。

(2) Rセッションの再起動(メモリの完全初期化)

アプリ停止後、RStudioのメニューバーから SessionRestart R (ショートカットキー: Ctrl + Shift + F10 / Macは Cmd + Shift + F10)を実行し、Rのセッションを完全に初期化する。

本スクリプトのように事前に大量のGTFSデータをメモリに展開する構造では、古いオブジェクトや関数のキャッシュが残りやすい。再起動によりメモリが完全にクリアされ、修正後の最新UIパラメータやロジックが100%クリーンな状態で読み込まれる。

[English]

R Code for Regional Analysis: Multi-Operator GTFS Integration, Automated Spatiotemporal Conversion, and Lightweight Pulse Animation

Notice

The paper associated with this research/dataset is available on SSRN. The latest version of the preprint, which includes corrected names of the analyzed municipalities and other textual updates, can be accessed here: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=6925698

V4.3: GTFS Generation for Agui Town "Agupi-go" (R Code)

Previously, only the creation of shapes.txt depended on Python code. This version migrates that process to the R environment, establishing a fully unified, single-language generation pipeline. By integrating publicly available bus stop and timetable data with bus route data from the National Land Numerical Information and automatically deriving route geometry within R, it achieves the "creation of precise GTFS data" (resolving data gaps and spatial discrepancies found in early versions) essential for simulations. Following the migration to R, the author has successfully verified that shapes.txt is accurately generated. The development process leveraged Claude 3.5 Sonnet and Gemini 1.5 Pro, while the final data consistency was verified by the author. No specialized infrastructure is required; GTFS generation and dynamic visualization can be executed solely within a standard R environment.

Version 4.2: GTFS Data Generation for Agui Town (Python Code)

The purpose of this repository is to provide a research dataset (Version 4.2) for the "Agupi-go" community bus in Agui Town, Aichi Prefecture, converted into the General Transit Feed Specification (GTFS) format with appended spatial linear geometry (shapes.txt). This dataset integrates publicly available bus stop and timetable data with bus route data from the National Land Numerical Information. Python algorithms were employed to automatically derive route geometry for each transit service, thereby addressing the lack of spatial precision for simulations found in the GTFS data generated in Version 4.0 (shapes.txt). The generation process utilized Anthropic’s Claude 3.5 Sonnet and Google’s Gemini 1.5 Pro to facilitate geometric logic construction and code implementation. The author has independently verified the logical consistency and validity of the final dataset. Please note that while Claude was instrumental in this GTFS creation, the included generate_shapes.py script was created retrospectively to reproduce the generation process and remains untested. This dataset is published as a research prototype and experimental output, contingent upon ongoing accuracy verification for future practical application.

 A demonstration covering five operators across four municipalities is available at: https://moteki.shinyapps.io/transit_chita5/

Source Data for Agupi-go GTFS Generation

1. Bus Stop and Timetable Information (Agui Town Official Website) Bus Stop Information: https://www.town.agui.lg.jp/0000005531.html Timetable Information: https://www.town.agui.lg.jp/0000005530.html

2. MLIT National Land Numerical Information (Bus Routes Data) Dataset: https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N07-v2_0.html (Fiscal Year 2022 version, File: N07-22_23_SHP.zip)

Open Data Used (GTFS)

The sample datasets utilized in this program are constructed based on the following publicly available open data:

  • [Higashiura Town (Community Bus "U-ra-ra")]

    • Data Creator: Higashiura Town

    • Data Source: Repository of Standard General Transit Feed Specification (GTFS) Datasets (Higashiura Town) https://gtfs-data.jp/search?&agencyId=higashiuratown (Note: Download by clicking the "GTFS" item under the "URLs" column in the data table. Example filename: feed_higashiuratown_communitybus_20260227_20260327151527.zip)

    • Procedures for Local File Placement:

      1. Decompress the obtained GTFS dataset (ZIP file) in your local environment.

      2. Move and place the resulting decompressed folder (e.g., feed_higashiuratown_communitybus_20260227_20260327151527) directly into the root of your R working directory, without altering its name or internal structure.

      3. Upon executing the program, the script will automatically parse and load the required text files—such as routes.txt, trips.txt, stops.txt, shapes.txt, and stop_times.txt—locally from the designated folder.

  • [Chita City (Community Bus "Aiai Bus")]

    • Data Creator: Chita City

    • Data Source: Repository of Standard General Transit Feed Specification (GTFS) Datasets (Chita City) https://gtfs-data.jp/search?&agencyId=chitacity (Note: The Chita City version of the program incorporates automated logic that directly fetches, decompresses, and processes the latest GTFS ZIP feed over the Web. Therefore, manual pre-downloading or local folder placement is not required for this specific component.)

  • [Chita Bus (Commercial Route: Chita Noriai Co., Ltd.)]

    • Data Creator: Chita Noriai Co., Ltd.

    • Data Source: Repository of Standard General Transit Feed Specification (GTFS) Datasets (Chita Bus) https://gtfs-data.jp/search?agencyId=chitabus

    • Procedures for Local File Placement (Identical to the "U-ra-ra" procedure described above):

      1. Decompress the obtained Chita Bus GTFS dataset (ZIP file) in your local environment.

      2. Move and place the resulting decompressed folder (e.g., feed_chitabus_chitabus_20260201_20260210144826) directly into the root of your R working directory, without altering its name or internal structure.

      3. Upon executing the program, the script will automatically parse and load the required text files—such as routes.txt, trips.txt, stops.txt, shapes.txt, and stop_times.txt—locally from the designated folder.

1. Distinctive Features and Comparison with Existing Tools (e.g., gtfs-box)

While this program shares the fundamental concept of dynamic public transit simulation using GTFS data with established precedents such as gtfs-box (https://github.com/nagix/gtfs-box), it offers distinct advantages in terms of practical simplicity and optimization for data science workflows.

(1) Unparalleled Simplicity (Infrastructure-Free, Single-Script Execution) Unlike typical web applications that require advanced knowledge of JavaScript or complex server-side infrastructure, this program functions immediately by placing the necessary GTFS text files into a designated working directory and executing the R script. This streamlined approach—eliminating the need for specialized infrastructure or complex configuration—provides a significant advantage for rapid deployment in practical transportation policy development and time-constrained educational settings, such as university workshops.

(2) Direct Optimization for Data Science Environments (R/Shiny) Built entirely within the R ecosystem (utilizing shiny, leaflet, tidyverse, and sf), which serves as the standard for regional analysis and GIS, the program is inherently compatible with professional data science workflows. Users can directly inspect and edit internal logic, such as linear interpolation, within the source code. Furthermore, the output vehicle trajectory data can be seamlessly integrated into further statistical analyses or combined with other regional analysis models, ensuring high extensibility for research purposes.

(3) Holistic Visualization of Regional Transit Networks Unlike existing approaches that often isolate individual operators or specific routes, this program provides a comprehensive visualization of the entire transit network from the moment of launch. Both the route infrastructure and dynamic vehicle objects (point markers) are persistently displayed and color-coded by their respective transit lines. This allows for intuitive, high-level policy insights into transit system design, enabling users to identify how multiple lines overlap, connect, and interact within the urban fabric.

Purpose and Regional Scope: The Milestone of V4.0

This data science package encapsulates a lightweight, high-performance geospatial framework engineered to synchronize, analyze, and visualize the dynamic operations of regional public transit networks across municipal borders.

The publication of Version 4.0 marked a major milestone by expanding the analytical scale to a 4-operator, regional integration model across the Chita Peninsula, Aichi Prefecture. It successfully consolidated a highly fragmented public transit environment under a single timeline:

  • Chita City: Regional commercial trunk lines (Chita Bus) and municipal local service (Aiai Bus).

  • Higashiura Town: Community transit lines (U-ra-ra).

  • Obu City: Community local loops (Fureai Bus), incorporating newly deployed static GTFS feeds.

  • Agui Town: Local community loops (Agupi-go).

By synthesizing these diverse datasets, the V4.0 framework established an agile platform for Evidence-Based Policy Making (EBPM), allowing policymakers, transport planners, and researchers to audit cross-boundary connectivity and inter-route dependencies at critical regional hub nodes.

Technical and Visual Resolution in Version 4.1

While V4.0 achieved broad territorial integration, it exposed a pervasive real-world challenge: institutional data friction and structural data gaps. In the case of Agui Town, official GTFS feeds are hindered by restrictive administrative gatekeeping—requiring approval-based credentialing to obtain access IDs—while updates on public platform systems have stagnated. Consequently, researchers must contend with severe data fragmentation, including a complete absence of official spatial track geometry lines (shapes.txt).

Version 4.1 delivers the definitive technical and visual resolution to these constraints through a two-fold architectural breakthrough:

  • Decoupled Spatiotemporal Data Architecture: Instead of processing raw, disparate GTFS text feeds at runtime, V4.1 introduces a highly optimized pipeline that pre-embeds complex transit schedules directly into the attribute fields of a standardized GeoPackage point layer. This completely eliminates runtime parsing overhead, enabling interactive web application servers to launch instantaneously without active runtime or memory bottlenecks.

  • Spatiotemporal Pulse-Emissive (Point-Based) Visualization Paradigm: To seamlessly circumvent missing route alignment tracks without distorting underlying schedule veracity, V4.1 shifts from traditional continuous line-routing animations to a point-based pulse-emissive rendering model. By mapping discrete vehicle positions as instantaneous point-flashes locked to exact stop arrival times, the visual artifacts of simplified linear interpolation (such as vehicles awkwardly warping or cutting through buildings) are entirely mitigated.

As a result, V4.1 achieves a uniform, consistent web simulation interface across all four municipalities, transforming highly heterogeneous local inputs into a crisp, synchronized regional asset.

2. Positioning in an International Context: Conceptual Design for Dynamic Accessibility Evaluation

The design philosophy of this program shares a strong conceptual foundation with the dynamic accessibility evaluation tool proposed by a research group in Wales (Webb et al., 2025). Webb et al. (2025) propose an interactive Web-GIS tool that enables policymakers to dynamically analyze and compare the impacts of mobility scenarios—such as bus route discontinuations, new route establishments, or service withdrawals—on public transport accessibility.

Uniqueness of this Implementation: "Lightweight" Design Eliminating Complex Infrastructure

While the primary objective—simulating the regional impacts of bus stop placement and route modifications to provide visual evidence for Evidence-Based Policy Making (EBPM)—aligns with the work of Webb et al., this program adopts a distinctive implementation approach:

  • Infrastructure-Free Design: Whereas the system proposed by Webb et al. requires a "heavyweight" design involving multi-layered server-side infrastructure (PostgreSQL/PostGIS, OpenTripPlanner, GeoServer, and PHP), this program pursues a "lightweight implementation" that operates entirely within a standard R environment on desktop or laptop computers.

  • Practical Applicability: By eliminating the reliance on complex infrastructure, this program ensures high mobility. It enables administrative staff with limited IT expertise, participants in time-constrained workshop settings, and students in programming courses to initiate scenario analysis immediately, provided they have access to GTFS data.

Reference: Webb, L., Langford, M., Higgs, G., & Berry, R. (2025). The design of a dynamic web-based solution to measure accessibility via public transport under different travel scenarios. Case Studies on Transport Policy, 21, 101561.

3. Guide to Related Versions

  • Version 2.0 (Static Flow Mapping Edition): For users who prefer a straightforward, static visualization of GTFS data (such as infrastructure flow mapping), the legacy Version 2.0 remains fully accessible via the link below:

    Moteki, Y. (2026). R Code for Regional Analysis: Interactive Flow Mapping of Public Transport Infrastructure using Leaflet and GTFS Data (v2.0). Zenodo. https://doi.org/10.5281/zenodo.20116368

  • GTFS-Realtime Integration Framework (Related Repository): For users interested in working with actual real-time data feeds (GTFS-Realtime) and exploring integrated visualization frameworks—featuring empirical cases such as the Toei Bus, Chita City "Aiai Bus", and Hiroshima Electric Railway Bus—the following sister repository is highly recommended:

    Moteki, Y. (2026). R Code for Regional Analysis: Integrated GTFS-Static and Realtime Public Transit Data Visualization Framework (v2.0). Zenodo. https://doi.org/10.5281/zenodo.20278677

4. Academic and Practical Value

The spatial accuracy and routing logic of this script have been verified and cross-referenced against the General Public Transport Map (Zakkuri Map) found within "How to Start Fun Public Transport," published by the Higashiura Town Regional Public Transport Council (validated at the v1.0 development stage). It serves as a highly versatile, turn-key baseline platform for other local government bodies, transport researchers, and students to "instantly convert raw local GTFS feeds into maps and empirically audit operational patterns with their own eyes." Furthermore, the rendering colors utilized for the routes in this application are synchronized with the official General Public Transport Map (extracted directly from the hex color codes embedded within the raw GTFS data).

5. Technical Notes: Safely Stopping the Application and Restarting the R Session

When modifying the code, following these two steps—"stopping the program" and "restarting the R session"—is the safest approach to ensure that changes are correctly reflected on the screen and to prevent malfunctions caused by residual memory.

(1) Stopping the Running Application (Releasing the Console)

Before rewriting the code, always click the red stop button located in the upper right corner of the RStudio console (or within the Viewer pane) to explicitly stop the application.

Simply closing the browser window may leave the local web server process running in the background, risking port conflict errors upon the next launch. Pressing the stop button safely shuts down the process and releases the occupied console.

(2) Restarting the R Session (Complete Memory Initialization)

After stopping the application, select Session ➔ Restart R from the RStudio menu bar (Shortcut: Ctrl + Shift + F10 / Cmd + Shift + F10 on Mac) to completely initialize the R session.

In scripts like this one, where large amounts of GTFS data are pre-loaded into memory, caches of old objects and functions tend to persist. Restarting completely clears the memory, ensuring that the latest modified UI parameters and logic are loaded in a 100% clean state.

Files

V4_2_agui_widemap.png

Files (46.3 MB)

Name Size Download all
md5:5884dce793e251bfc4803972c9248709
5.2 kB Download
md5:64e3c37ede6a8375a96e996efde6c459
6.5 kB Download
md5:a173c420d9cb255611a5a59653230ded
20.4 kB Preview Download
md5:82ca16fcd212347f00404c805550cbc1
43.3 kB Preview Download
md5:768827b4ea2efc9234c054c8e44ac605
593.8 kB Preview Download
md5:03f789b9d4c3359f7bf74c65c011f1a5
233.7 kB Preview Download
md5:f60732f62324a2e7d72faec5aab2f853
479.2 kB Download
md5:1174ea54660e74e9f3b48846f8677a70
6.1 MB Download
md5:167b07de8c3d454495c25db2741e8427
8.9 kB Download
md5:0ae23fd9128f923f94a26a2dbb4cb090
664.2 kB Preview Download
md5:37973bc598d236bba05182d2efb74a10
710.8 kB Preview Download
md5:e4779a5bec02d0b254a73f776dca8dd5
18.5 kB Download
md5:c5500c77d5e490293f950370b91e46f5
949.4 kB Preview Download
md5:d87fb3da745cad3da73b21f485160298
870.2 kB Preview Download
md5:e238f31e0563359d5329cd80afcaaa21
830.8 kB Preview Download
md5:8bc4fb156fe2e6c52184c737ddd98a2c
11.4 kB Download
md5:acc4aeccbbdf2658e7c6f2e38738ced5
9.6 kB Download
md5:c89bad3d632b143184127b8ececc5591
1.4 MB Preview Download
md5:05b588b91c245875e5e7bb93637baa8f
9.9 kB Download
md5:5790377a11cbf947cebf909a76e7670f
2.4 MB Preview Download
md5:198fd66275db5af721a7825275a84783
2.2 MB Preview Download
md5:ac1bbb01e904ea0e53cdcd153cf0bc6c
2.6 MB Preview Download
md5:d1e4849675ae3f0ac7cc3aa4c4096f32
10.0 MB Preview Download
md5:d9b8199a7eb69fe208f917808b9aa3a5
15.3 kB Download
md5:cb7ee1d29028f56558bb21485c56a7a0
385.4 kB Preview Download
md5:54ef6fa3e32cf9a25fede783d7fbdc8e
1.4 MB Preview Download
md5:811e686312e4fcce996c494708ed2a5e
464.2 kB Preview Download
md5:3f73d19efe7fae35351316ca05474da5
583.4 kB Preview Download
md5:43431d557ea93ec064838cb7c33a96f7
543.3 kB Preview Download
md5:a34f1e6c6304f6c121d8bde9624749cc
7.3 kB Download
md5:7edfd14ff2ec3a9d3a29f692811e666c
1.0 MB Preview Download
md5:7edfd14ff2ec3a9d3a29f692811e666c
1.0 MB Preview Download
md5:0c46f82039d365608523fc1c6eb3097f
8.3 kB Download
md5:d2e3ab29a3fa166f0fbce3e6735d68c3
6.1 kB Download
md5:7e98675d127cc58eaaf66aeef5caef72
6.4 kB Download
md5:4a134b5fdefa33c7b0e0e1d10b5f0d89
297.7 kB Preview Download
md5:9b929c4fef88e7bec1e8bd7d7d2e7964
8.7 kB Download
md5:3014dbb88374489435d4b97b1d0543cc
6.0 kB Download
md5:fd38e374de512e1c2380563ebec3fe08
8.0 kB Download
md5:bce5f2f4867e0bd20539bef4f179cb65
13.0 kB Preview Download
md5:49bdaace71ae218b1f836d7d8efe3406
22.0 kB Preview Download
md5:5888357fbc60f75c4740bc0722a1dabc
1.5 MB Preview Download
md5:423daf45d3563164344b4f8aa3371079
7.0 MB Preview Download
md5:c1d47162c756e44bb2596076d0e7c19c
892.8 kB Preview Download
md5:6b6691be8bb781a291edab55319bfd46
985.5 kB Preview Download

Additional details

Software

Programming language
R