Skip to contents

get_boundary() downloads and reads one or more MAFF agricultural community boundary datasets and returns them as a named list of sf::sf() objects. The target prefectures are determined from data.

Usage

get_boundary(
  data,
  boundary_data_year = NULL,
  rcom_year = 2025L,
  boundary_type = 1,
  path = NULL,
  suffix = FALSE,
  crs = NULL,
  encoding = "CP932",
  quiet = FALSE
)

Arguments

data

A Fude Polygon data object returned by read_fude(), a vector of numeric prefecture codes, or a character vector of prefecture codes, Japanese prefecture names, municipality codes, or ten-character boundary keys.

boundary_data_year

The year of the boundary dataset. If NULL, rcom_year is used.

rcom_year

The agricultural community reference year used in the MAFF file name. Supply a single numeric or character year listed in rcom_year_id.

boundary_type

Integer specifying the boundary level to read: 1 for agricultural community, 2 for former municipality, and 3 for municipality.

path

Path to a directory containing boundary ZIP files. If NULL, ZIP files are downloaded automatically.

suffix

Logical. If FALSE, suffixes are removed from romaji municipality names, such as "-shi" and "-ku".

crs

Coordinate reference system to transform the output data to. If NULL, the source CRS is kept.

encoding

Character encoding of the source shapefile attributes, such as "CP932".

quiet

Logical. If TRUE, suppress messages during download and reading.

Value

A named list of sf::sf() objects.

Examples

if (FALSE) { # interactive()
path <- system.file("extdata", "castle.zip", package = "fude")
d <- read_fude(path)
b <- get_boundary(d)
}