R Code for Regional Analysis: Identifying and Visualizing Public Transport Service Gaps 地域分析のためのRコード:公共交通空白地帯の特定と可視化
Abstract
地域分析のためのRコード:公共交通空白地帯の特定と可視化 概要(Description) 行政区域データとバス停留所データを活用し、公共交通の恩恵を受けにくい「公共交通空白地帯」を抽出・可視化するRスクリプトである。バス停から一定距離(500m等)を歩行圏と定義し、行政区域からその圏内を差し引く「差分抽出(st_difference)」の手法を用いることで、課題エリアを直感的かつ客観的に特定することを主目的とする。 本スクリプトの最大の特徴は、GTFS等の複雑なデータ構造や専門的なGISソフトに依存せず、Rの sf パッケージによる数行の空間演算のみで完結している点にある。分析プロセスにおいて、メートル単位の正確な計算を可能にする投影変換(UTM座標系への変換)を含んでおり、分析の科学的妥当性と再現性を確保している。分析者自身が元データを直接管理・加工できるため、自治体の将来計画や政策科学に基づく政策決定の基礎資料作成において高い柔軟性を発揮する。 QGISを用いた交通空白地帯の可視化として、半井真明 (2022) 『QGIS入門:GISで地域の課題を可視化する』(学芸出版社)の第11章があり、同書から着想を得た。本コードについては、GISソフトを介さずに交通空白地帯を可視化し、地域公共交通のあり方を議論するための基礎的な資料を迅速に作成することを目的としている。Google Geminiのコード作成支援を利用した。本コードは、南山大学のゼミ(プロジェクト研究)において地域分析のための手法としてLMSに共有していたものである。このコードを用い、2026年3月に卒業した行政学ゼミ1期生が、卒業論文において交通空白地帯の分析図を作成するなど、実際の教育・研究の現場で活用された実績を有している。 分析用のデータ入手先 本分析には、国土数値情報ダウンロードサイトから取得した以下のデータを使用する。 行政区域データ(N03) URL: https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N03-v3_1.html バス停留所データ(P11) URL: https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-P11-2022.html 実行手順と注意点 上記URLより愛知県のデータをそれぞれ選択してダウンロードする。 ダウンロードしたZIPファイルを解凍し、構成ファイル(N03-20_23_200101.shp や P11-22_23.shp など)をRの作業フォルダに配置する。 スクリプト内のファイル名が、実際のダウンロードファイル名と一致しているか確認して実行すること。 実行結果の地図は、RStudio内の「Plots」タブに出力される。本ページでの出力例は愛知県一宮市である。 【関連ツール:インタラクティブな空間重ね合わせ分析】 本分析とは異なる切り口から地域を捉えるツールを公開している。 本リポジトリは静的マッピングによる「交通空白地帯の特定」に主眼を置いているが、以下の関連ツールでは Leaflet を用い、将来の人口需要と交通供給の空間的な重ね合わせを動的に可視化している(同様に、一宮市のデータを実証事例として使用)。 「空白地帯の把握」と「需要供給の構造分析」という、互いに補完し合う政策科学のための基礎ツールとして、あわせて活用されたい。 【インタラクティブ版:需要供給の重ね合わせ分析ツール】 https://doi.org/10.5281/zenodo.20016119 [English] R Code for Regional Analysis: Identifying and Visualizing Public Transport Service Gaps (Walking Distance Buffers) Description This R script identifies and visualizes "public transport service gaps"—areas lacking easy access to bus stops—by processing administrative boundaries and transit location data. By defining a specific walking radius (e.g., 500m) around bus stops and subtracting these service areas from the total municipal area using the st_difference function, it enables the intuitive and objective identification of underserved regions. The defining feature of this script lies in its efficiency, executing entirely through a few lines of spatial operations using the R sf package without relying on complex data structures such as GTFS or specialized GIS software. The analytical workflow incorporates coordinate transformation into a projected coordinate system (UTM), enabling precise meter-based calculations and thereby ensuring scientific validity and reproducibility. By allowing analysts to directly manage and process raw datasets, this framework offers high flexibility when preparing foundational materials for municipal long-term planning and informed policy decision-making grounded in policy sciences. The methodology for visualizing transport gaps using QGIS is detailed in Chapter 11 of "QGIS Nyumon (Introduction to QGIS)" by Masaaki Nakarai (2022, Gakugei Shuppansha), which served as the inspiration for this work. This script aims to provide a tool for visualizing these gaps without specialized GIS software, facilitating the rapid creation of essential materials for discussing the future of regional public transportation. The development of the code was supported by Google Gemini. This script was originally shared via the Learning Management System (LMS) for the Public Administration seminar at Nanzan University as a methodology for regional analysis. It has been utilized in actual educational and research settings, including by the first cohort of students in the Public Administration seminar (graduating class of March 2026) to generate analytical figures for their graduation theses. Data Sources This analysis utilizes the following datasets obtained from the National Land Numerical Information Download Service: Administrative Boundary Data (N03) URL: https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N03-v3_1.html Bus Stop Location Data (P11) URL: https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-P11-2022.html Execution Procedures & Notes Download the data for the target area (e.g., Aichi Prefecture) from the URLs above. Extract the downloaded ZIP files and place the constituent files (e.g., N03-20_23_200101.shp, P11-22_23.shp, etc.) in your R working directory. Ensure the file names in the script match the actual downloaded file names before execution. The resulting map will be output to the "Plots" tab within RStudio. Note: The example output featured on this page is Ichinomiya City, Aichi Prefecture. [Related Tool: Interactive Spatial Overlay] For a different analytical perspective, please refer to the following interactive tool. While this repository focuses on identifying "public transport deserts" via static mapping, the related tool below utilizes Leaflet to visualize the spatial overlay of future population demand and infrastructure supply (similarly using Ichinomiya City data as an empirical case study). These function as foundational tools for policy science, complementing each other from different angles. [Interactive Variant: Demand-Supply Overlay Tool] https://doi.org/10.5281/zenodo.20016119
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 27 April 2026
- Language
- EN