最終更新:2026-01-01
Rで利用しやすい行政境界データとしては、主に以下が挙げられる。
polbnda_jpn.shp(4.1MB)が市区町村境界データを含むシェープファイルである。# 必要なパッケージの読み込み
library(sf)
# シェープファイルの読み込み
chikyu <- sf::st_read("gm-jpn-all_u_2_2/polbnda_jpn.shp")## Reading layer `polbnda_jpn' from data source
## `/Users/ayumu/Documents/GitHub/research/4_GIS/MapJapan/gm-jpn-all_u_2_2/polbnda_jpn.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 2914 features and 9 fields
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: 122.9335 ymin: 20.42274 xmax: 153.9869 ymax: 45.55733
## Geodetic CRS: ITRF94
## Coordinate Reference System:
## User input: ITRF94
## wkt:
## GEOGCRS["ITRF94",
## DYNAMIC[
## FRAMEEPOCH[1993]],
## DATUM["International Terrestrial Reference Frame 1994",
## 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["Geodesy."],
## AREA["World."],
## BBOX[-90,-180,90,180]],
## ID["EPSG",8994]]
含まれる属性フィールドは以下の通りである。
# 地図の作成
library(ggplot2)
ggplot(data = chikyu) + # 地図データの指定
geom_sf(fill = "lightblue", color = "black") + # 塗りつぶし色と境界線の色の指定
theme_minimal() + # ミニマルテーマの適用
labs(title = "Global Map Japan",
subtitle = "Administrative Boundaries of Japan",
caption = "Source: Geospatial Information Authority of Japan") +
theme(axis.text = element_blank(), # 目盛りを非表示
axis.title = element_blank()) # 軸タイトルを非表示TRUE