read_fude() reads MAFF Fude Polygon data from a ZIP file and returns the
layers as a named list of sf::sf() objects. If path is not supplied, the
function downloads the ZIP file for the specified prefecture and year using
pref, year, and rcom_year.
The ZIP archive may contain one or more supported spatial files in GeoJSON
(.json or .geojson) or FlatGeobuf (.fgb) format. The function also
works with ZIP files created manually, provided that the original file names
are preserved.
Usage
read_fude(
path = NULL,
pref = NULL,
year = NULL,
rcom_year = NULL,
crs = NULL,
supplementary = FALSE,
quiet = FALSE
)Arguments
- path
Path to a ZIP file containing one or more supported spatial files. If
NULL, the file is downloaded automatically from the MAFF website usingpref,year, andrcom_year.- pref
Prefecture name or prefecture code used when downloading data. Ignored if
pathis supplied.- year
The Fude Polygon data year used in the download file name. Defaults to 2026 when downloading.
- rcom_year
The agricultural community reference year used in the download file name and to fill missing reference years in local files. Defaults to 2025 for the default download. Supply this argument when downloading another release.
- crs
Coordinate reference system to transform the output layers to. If
NULL, the original CRS is kept.- supplementary
Logical. If
TRUE, add supplementary columns such as land-use labels and polygon area.- quiet
Logical. If
TRUE, suppress messages during download and reading.
Value
A named list of sf::sf() objects with issue_year and rcom_year columns.
Details
Recorded years are retained. Missing issue years are taken first from the
member name and then from the ZIP name. Missing reference years are taken
from rcom_year, the member name, or the ZIP name, in that order. For example,
MB0001_2026_2025_38.fgb supplies an issue year of 2026 and a reference year
of 2025 even when the enclosing ZIP has a custom name. When an MB0001
member has conflicting year information, the function warns and applies
the same precedence.
Examples
path <- system.file("extdata", "castle.zip", package = "fude")
d <- read_fude(path)
#> Reading layer `2021_382019' from data source
#> `/private/var/folders/34/cc5j3spj0xs23b_r3j27pcr00000gn/T/RtmpYWmHYs/filebebb315e6675/castle/2021_382019.json'
#> using driver `GeoJSON'
#> Simple feature collection with 1 feature and 7 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 132.7653 ymin: 33.84506 xmax: 132.7662 ymax: 33.84575
#> Geodetic CRS: WGS 84
#> Reading layer `2022_382019' from data source
#> `/private/var/folders/34/cc5j3spj0xs23b_r3j27pcr00000gn/T/RtmpYWmHYs/filebebb315e6675/castle/2022_382019.json'
#> using driver `GeoJSON'
#> Simple feature collection with 1 feature and 7 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 132.7653 ymin: 33.84506 xmax: 132.7662 ymax: 33.84575
#> Geodetic CRS: WGS 84
#> Reading layer `2022_382078' from data source
#> `/private/var/folders/34/cc5j3spj0xs23b_r3j27pcr00000gn/T/RtmpYWmHYs/filebebb315e6675/castle/2022_382078.json'
#> using driver `GeoJSON'
#> Simple feature collection with 1 feature and 7 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 132.541 ymin: 33.50931 xmax: 132.5415 ymax: 33.50966
#> Geodetic CRS: WGS 84