MyNixOS website logo
Description

Japan Maps with Insets for Okinawa and Ogasawara.

Provides tools for drawing maps of Japan with prefecture and municipal boundaries. The plotting workflow mirrors the 'usmap' package and includes a transform that moves Okinawa and Ogasawara into visible inset locations. Boundary helpers build local 'GeoPackage' files from Japan's official MLIT N03 administrative area data <https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N03-2024.html>.
jpmap logo

R-CMD-check

jpmap: Japan maps with visible island insets


jpmap is an R package for drawing maps of Japan with an API modeled after usmap.

The package is designed to be the everyday Japan-map workflow for R users: request a map, join ordinary tabular data, and publish a static or interactive figure without writing one-off GIS scripts.

Inset behavior is selectable: use inset = TRUE for both Okinawa and Ogasawara, inset = FALSE for a literal projected map, or values such as inset = "okinawa" to transport only selected island groups. You can also use okinawa = FALSE or ogasawara = FALSE. plot_jpmap() draws inset boxes by default; set inset_boxes = FALSE to remove them.

Use territorial_disputes = FALSE to exclude areas discussed in Japan territorial-dispute references, or pass a subset such as "senkaku" or "takeshima".

For website maps, jp_map_leaflet() returns a Leaflet htmlwidget using literal longitude/latitude geography.

Installation

Install the development version from GitHub:

install.packages("remotes")
remotes::install_github("yhoriuchi/jpmap")

Boundary GeoPackages are large and live outside the functionality package. Install the companion data package when you want ready-to-use boundary files, or build the files locally from MLIT source data.

remotes::install_github("yhoriuchi/jpmapdata")

Core Workflow

library(tidyverse)
library(jpmap)

plot_jpmap("prefecture")
plot_jpmap("municipality", include = "Okinawa")
plot_jpmap("prefecture", territorial_disputes = FALSE)

gdp <- jp_prefecture_gdp |>
  select(pref_code, gdp_per_capita_jpy)

jp_map("prefecture") |>
  jp_map_join(gdp, by = "pref_code")

Articles

Start with these pages:

Then use the plotting tutorials:

Transform Point Data

Use jpmap_transform() to put user-supplied longitude and latitude data into the same projected coordinate system used by plot_jpmap().

library(tidyverse)
library(jpmap)

points <- tribble(
  ~place, ~lon, ~lat,
  "Tokyo", 139.767, 35.681,
  "Naha", 127.681, 26.212,
  "Ogasawara", 142.191, 27.094
)

points |>
  jpmap_transform()

Boundary Data

jpmap looks for boundary GeoPackages in the companion jpmapdata package and in the local data directory returned by jpmap_data_dir().

After boundary data are available, draw Okinawa municipalities with:

plot_jpmap("municipality", include = "Okinawa")

You can also build boundary files locally from Japan's official MLIT National Land Numerical Information N03 administrative area data:

jpmap_build_data(year = 2024)
jpmap_build_data(year = 2024, prefecture = "Ehime")

The generated file is written to jpmap_data_dir() by default and contains two layers:

  • prefectures
  • municipalities

After data is available, jp_map() returns sf objects and plot_jpmap() returns ordinary ggplot2 maps. Users who already work with jpndistrict can also pass its sf output through jpmap_transform().

Example Data

Two public-source sample datasets are included:

  • jp_prefecture_gdp: 2021 prefecture GDP per capita values.
  • jp_us_military_bases: selected U.S. military installations in Japan with coordinates, public approximate personnel figures where available, and row-level source_url links.
Metadata

Version

0.1.3

License

Unknown

Platforms (79)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    wasip1
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasip1
  • wasm64-wasip1
  • x86_64-cygwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows