最終更新:2026-01-02
N05-24_GML.zip(39.1MB)をダウンロードする。駅については:
路線については:
# 必要なパッケージの読み込み
library(sf)
# シェープファイルの読み込み
eki <- sf::st_read("N05-24_GML/UTF-8/N05-24_Station2.shp")## Reading layer `N05-24_Station2' from data source
## `/Users/ayumu/Documents/GitHub/research/4_GIS/railway/N05-24_GML/UTF-8/N05-24_Station2.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 23812 features and 11 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: 127.6523 ymin: 26.19326 xmax: 145.7539 ymax: 45.41634
## Geodetic CRS: JGD2011
## Coordinate Reference System:
## User input: JGD2011
## wkt:
## GEOGCRS["JGD2011",
## DATUM["Japanese Geodetic Datum 2011",
## ELLIPSOID["GRS 1980",6378137,298.257222101,
## LENGTHUNIT["metre",1]]],
## PRIMEM["Greenwich",0,
## ANGLEUNIT["degree",0.0174532925199433]],
## CS[ellipsoidal,2],
## AXIS["geodetic latitude (Lat)",north,
## ORDER[1],
## ANGLEUNIT["degree",0.0174532925199433]],
## AXIS["geodetic longitude (Lon)",east,
## ORDER[2],
## ANGLEUNIT["degree",0.0174532925199433]],
## USAGE[
## SCOPE["Horizontal component of 3D system."],
## AREA["Japan - onshore and offshore."],
## BBOX[17.09,122.38,46.05,157.65]],
## ID["EPSG",6668]]
# 必要なパッケージの読み込み
library(sf)
# シェープファイルの読み込み
senro <- sf::st_read("N05-24_GML/UTF-8/N05-24_RailroadSection2.shp")## Reading layer `N05-24_RailroadSection2' from data source
## `/Users/ayumu/Documents/GitHub/research/4_GIS/railway/N05-24_GML/UTF-8/N05-24_RailroadSection2.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 2645 features and 11 fields
## Geometry type: LINESTRING
## Dimension: XY
## Bounding box: xmin: 127.6523 ymin: 26.19315 xmax: 145.7539 ymax: 45.41634
## Geodetic CRS: JGD2011
## Coordinate Reference System:
## User input: JGD2011
## wkt:
## GEOGCRS["JGD2011",
## DATUM["Japanese Geodetic Datum 2011",
## ELLIPSOID["GRS 1980",6378137,298.257222101,
## LENGTHUNIT["metre",1]]],
## PRIMEM["Greenwich",0,
## ANGLEUNIT["degree",0.0174532925199433]],
## CS[ellipsoidal,2],
## AXIS["geodetic latitude (Lat)",north,
## ORDER[1],
## ANGLEUNIT["degree",0.0174532925199433]],
## AXIS["geodetic longitude (Lon)",east,
## ORDER[2],
## ANGLEUNIT["degree",0.0174532925199433]],
## USAGE[
## SCOPE["Horizontal component of 3D system."],
## AREA["Japan - onshore and offshore."],
## BBOX[17.09,122.38,46.05,157.65]],
## ID["EPSG",6668]]
| 属性名(shp属性名) | 説明 | 属性の型 |
|---|---|---|
| 事業者種別(N05_001) | 鉄道路線の事業者を区分するコード | コードリスト「事業者種別コード」 |
| 路線名(N05_002) | 鉄道路線の名称 | 文字列型(CharacterString) |
| 運営会社(N05_003) | 鉄道路線を運営する会社名 | 文字列型(CharacterString) |
| 供用開始年(N05_004) | 当該区間の供用が開始された年(西暦年)。不明な場合は999とする | 時間型(TM_Instant) |
| 設置期間(設置開始)(N05_005b) | 鉄道路線、駅が設置された年(西暦年)。1950年(昭和25年)以前に設置された場合は1950とする | 時間型(TM_Instant) |
| 設置期間(設置終了)(N05_005e) | 鉄道路線、駅が変更・廃止された年の一年前の年(西暦年)。現存する場合は9999、不明な場合は999とする | 時間型(TM_Instant) |
| 関係ID(N05_006) | 路線および駅の属性が変更された場合の同一地物である事を表すグループID(その他の情報欄に詳細を説明) | 文字列型(CharacterString) |
| 変遷ID(N05_007) | 同一年次に複数回属性が変更された場合の属性項目を表す識別子 | コードリスト「変遷IDコード」 |
| 変遷備考(N05_008) | 変遷IDで示した属性の内容を記述する | 文字列型(CharacterString) |
| 備考(N05_009) | 駅位置や路線位置が不明確な場合の図形データの精度に関するコメント | 文字列型(CharacterString) |
ggplot2# 地図の作成
library(ggplot2)
ggplot(data = eki) + # 地図データの指定
geom_sf(size = 0.3, color = "blue") + # 駅を赤点
theme_minimal() + # ミニマルテーマの適用
labs(title = "Railway Stations",
subtitle = "Japan",
caption = "Source: Ministry of Land, Infrastructure, Transport and Tourism") +
theme(axis.text = element_blank(), # 目盛りを非表示
axis.title = element_blank()) # 軸タイトルを非表示 TRUE
ggplot2# 地図の作成
library(ggplot2)
ggplot(data = senro) + # 地図データの指定
geom_sf(
color = "red", # 路線の色
size = 0.8,
alpha = 0.7
) +
theme_minimal() + # ミニマルテーマの適用
labs(title = "Railway Lines",
subtitle = "Japan",
caption = "Source: Ministry of Land, Infrastructure, Transport and Tourism") +
theme(axis.text = element_blank(), # 目盛りを非表示
axis.title = element_blank()) # 軸タイトルを非表示TRUE
ggplot2library(ggplot2)
library(sf)
ggplot() +
# 線路を背景に(先に描画)
geom_sf(data = senro,
color = "blue",
alpha = 0.9,
size = 0.05) +
# 駅を前景に(後に描画)
geom_sf(data = eki,
color = "red",
alpha = 0.1,
size = 0.0001) +
theme_minimal() +
labs(title = "Railway Network and Stations",
subtitle = "Japan",
caption = "Source: Ministry of Land, Infrastructure, Transport and Tourism") +
theme(axis.text = element_blank(),
axis.title = element_blank())TRUE