R Code for Regional Analysis: Spatiotemporal Logging and Pulse Simulation of Integrated GTFS-Static and Realtime Data 地域分析のためのRコード: GTFS静的・リアルタイム公共交通データの統合的可視化(都営バス、知多市「あいあいバス」、広島電鉄バスを例に)
Abstract
Abstract / Description This open-source repository provides a standalone, lightweight infrastructure designed to instantly visualize GTFS Realtime (GTFS-RT) public transit data within the R environment. While the digitization of scheduled transit data (GTFS-Static) has expanded rapidly across local governments and community bus networks, the practical utilization of dynamic transit data (GTFS-RT) remains severely limited due to heavy server maintenance costs and steep technical hurdles in decoding binary streams. Conventional visualization approaches often rely on time-series logging of binary files followed by asynchronous rendering via external web tools, which limits analysis to post-hoc, passive playback. In contrast, this minimal script operates directly on memory without requiring heavy zip downloads, static file unpacking, or complex table joins. By removing these structural dependencies, the script fundamentally eliminates silent data-type mismatch errors and system crashes, establishing a highly resilient, on-demand visualization pipeline capable of rendering large-scale urban fleets without causing memory-induced browser latency. Technical assistance from Google Gemini was utilized to support the implementation of this code. Building upon the technical challenges highlighted in recent industry reviews—such as the NTT DOCOMO Developer Blog (https://nttdocomo-developers.jp/entry/20231218_1) and open-source implementation reports on Qiita (https://qiita.com/bebebefu/items/9d0be6bfcd1e86a21ac4)—this architecture directly addresses the common bottlenecks that frequently discourage practitioners from adopting live transit feeds. While conventional methods struggle with the complexities of parsing Protocol Buffers (.pb) and managing memory overhead in interactive environments, this R-based script introduces a dynamic global flag-guard mechanism that intercepts and prevents duplicate symbol registration errors within the underlying C++ engine of RProtoBuf. By decoupling the realtime vehicle position feed from static datasets, the script ensures that live geographic coordinates are streamed seamlessly into an interactive Leaflet mapping interface with automatic bounding-box camera adjustments. This completely independent, maintenance-free setup provides a solid technical framework for real-time validation, dynamic delay monitoring, and live public transit workshops. It serves as a plug-and-play toolkit for Project-Based Learning (PBL) and Participatory GIS (PPGIS), empowering researchers and regional planners to capture the exact operational pulse of transit networks with zero configuration overhead. Abstract / Description of Version 3.0 This Version 3 (V3) update establishes an innovative R pipeline that transforms transient, disposable GTFS-Realtime transit feeds into structured, historical spatiotemporal archives through a resource-saving, 60-second polling protocol. By decoupling heavy static transit geometries and schedule metadata into a pre-compiled RDS asset, the system completely eliminates startup latency and achieves flawless, flicker-free differential synchronization during the 1-minute step playback. Strictly complying with Color Universal Design (CUD) standards, the interface optimizes the brightness contrast of regional identity colors—layering thick white-bordered lime green dynamic vehicle pins over municipal moss green routes—while deferring scheduled stop rendering to minimize both browser and cognitive overhead. Ultimately, this framework elevates live transit streams into a portable, auditable empirical asset that empowers diverse stakeholders to objectively examine schedule-reality discrepancies, thereby advancing the methodologies of Public Participation GIS (PPGIS) and evidence-based policy making (EBPM). V3 demo https://moteki.shinyapps.io/GTFS_RT/ Abstract / Description of Version 2.0 Version 2 (v2.0) expands upon the standalone, lightweight infrastructure established in the initial release by introducing a robust integration framework with static schedule data (GTFS-Static). This update enables the dynamic reconstruction of transit networks (using geometry from shapes.txt) and features an interactive schedule-lookup system directly embedded within the map interface. To accommodate dense municipal networks—such as the extensive fleet operated by Hiroshima Electric Railway (Hiroden Bus)—without inducing browser latency or memory-induced crashes, this architecture implements marker clustering and deferred on-click popup rendering. Furthermore, v2.0 introduces native compatibility with the Japanese specific extension (routes_jp.txt), allowing the system to parse and bind complex routing context (origin, via, and destination attributes) to real-time vehicle markers without data-type mismatches. It also incorporates a local caching protocol for protocol buffer definitions (gtfs-realtime.proto), eliminating redundant remote calls, ensuring stable execution under server rate-limits, and optimizing the toolkit for practical application in regional analysis and Participatory GIS (PPGIS) frameworks. Looking for the Minimal Version? (Version 1.0) If you prefer the original, ultra-lightweight standalone scripts that track live vehicle positions without requiring static schedule data (GTFS-Static), please refer to the initial release (Version 1.0). This minimal version is optimized for instant deployment and low-bandwidth environments (featuring Tokyo Toei Bus and Chita City "Aiai Bus" minimal examples). The repository for Version 1.0 can be accessed here: https://doi.org/10.5281/zenodo.20277604 Newly Added Files and Descriptions The following scripts and verification deliverables have been newly integrated into the v2.0 release package: GTFS_RT_static_aiaibus.r Description: An integrated R script for Chita City's "Aiai Bus" that fully merges GTFS-Static components (shapes, stops, and schedules) with real-time feeds, featuring an efficient hover-activated timetable popup optimized for localized municipal scales. GTFS_RT_static_aiaibus_widemap.png / _popbus.png / _popstop.png Description: Technical validation images confirming successful execution, geographic binding, and interactive popup rendering for the Chita City static-realtime integrated pipeline. GTFS_RT_static_hirodenbus.R Description: A scale-optimized R script designed for large-scale transit networks (Hiroshima Electric Railway). It utilizes marker clustering and on-click popups to manage memory overhead when handling thousands of stops and extensive scheduled datasets. GTFS_RT_static_hirodenbus_widemap.png / _popbus.png / _popstop.png Description: Empirical output verifications demonstrating proper cluster allocation, route flow matching, and sliced schedule display under the Hiroden Bus full-stack pipeline. GTFS_RTonly_hirodenbus.R Description: A lightweight, stream-centric R script for Hiroden Bus that bypasses heavy spatial geometries while maintaining attribute-level synchronization with routes_jp.txt to display human-readable route contexts on live markers. GTFS_RTonly_hirodenbus_widemap.png / _popbus.png Description: Deployment verifications for the stream-centric Hiroden Bus script, showcasing broad regional coverage and accurate textual mapping of vehicle coordinates. Repository Structure / Included Files This repository contains the following deployment and verification files: GTFS_RT_TOKYOtoei_bus.R: A minimal, standalone R script optimized for the on-demand parsing, structural decoding, and real-time visualization of the Toei Bus fleet in Tokyo. It establishes a fast, zero-dependency data flow mapping live positions onto a Leaflet interface. GTFS_RT_Chita_minimal.R: A minimal, robust R script tailored for capturing and plotting live spatial metrics from Chita City’s "Aiai Bus" community transit feed. It skips static database initialization to ensure lightweight executing and fault-tolerant parsing. GTFS_RT_tokyo_widemap.png & GTFS_RT_tokyo_popup.png: Proof-of-concept visual outputs showcasing the successful wide-area deployment over the Tokyo metropolitan grid, including a detailed contextual pop-up verification containing live Vehicle, Route, and Trip IDs. GTFS_RT_chita_aiai_widemap.png & GTFS_RT_chita_aiai_pop.png: Verification images demonstrating successful execution on localized municipal scales (Chita City), validating that the pipeline cleanly captures attribute characteristics even when static parameters like route_id evaluate to NA. GTFS-Realtime Data Sources and Portals The real-time transit data streams visualized in this repository are sourced from and documented on the following official platforms: Toei Bus (Bureau of Transportation, Tokyo Metropolitan Government): This high-density metropolitan feed is officially managed by the Public Transportation Open Data Center (ODPT). The endpoint streams live vehicle positions over Tokyo's intensive urban network. Developer registration, explicit data terms, and specific resource metadata can be reviewed through the official ODPT data portal resource catalog (https://ckan.odpt.org/ja/dataset/b_bus_gtfs_rt-toei/resource/4c440b4d-ae78-4eb2-bf4e-c6e9eb2fa717). Chita City "Aiai Bus" (Chita City, Aichi Prefecture): This community transit feed delivering localized municipal metrics is distributed via the open transit data infrastructure synchronized with Jorudan Co., Ltd. (https://realtime.gtfs.info/). The comprehensive dataset directory, feed organization metadata, and static/real-time repository status can be reviewed directly via the official Japan GTFS Data Repository search portal (https://gtfs-data.jp/search?agencyName=%E7%9F%A5%E5%A4%9A%E5%B8%82). Important Note on Access Frequency and Rate-Limiting Users must strictly adhere to the access guidelines stipulated by open data infrastructure providers. Public transit servers—particularly municipal endpoints hosting community bus data—frequen
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 15 June 2026
- Language
- EN