Skip to contents

The fude package provides utilities to facilitate the handling of the Fude Polygon data downloadable from the Ministry of Agriculture, Forestry and Fisheries (MAFF) website. The word “fude” is a Japanese counter suffix used to denote land parcels.

Obtain data

Fude Polygon data can now be downloaded from two different MAFF websites (both available only in Japanese):

  1. GeoJSON format:
    https://open.fude.maff.go.jp

  2. FlatGeobuf format:
    https://www.maff.go.jp/j/tokei/census/shuraku_data/2020/mb/

Install the package

You can install the released version of fude from CRAN with:

Or the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("takeshinishimura/fude")

Usage

Read Fude Polygon data

There are two ways to load Fude Polygon data, depending on how the data was obtained:

  1. From a locally saved ZIP file:
    This method works for both GeoJSON (from Obtaining Data #1) and FlatGeobuf (from Obtaining Data #2) formats. You can load a ZIP file saved on your computer without unzipping it.
library(fude)
d <- read_fude("~/2022_38.zip")
  1. By specifying a prefecture name or code:
    This method is available only for FlatGeobuf data (from Obtaining Data #2). Provide the name of a prefecture (e.g., “愛媛”) or its corresponding prefecture code (e.g., “38”), and the required FlatGeobuf format ZIP file will be automatically downloaded and loaded.
d2 <- read_fude(pref = "愛媛")

Inspect the structure of Fude Polygon data

ls_fude(d)
#> # A tibble: 20 × 7
#>    name     issue_year local_government_cd     n pref_name city_name city_romaji
#>    <chr>         <int> <chr>               <int> <chr>     <chr>     <chr>      
#>  1 2022_38…       2022 382019              72045 愛媛県    松山市    Matsuyama-…
#>  2 2022_38…       2022 382027              43396 愛媛県    今治市    Imabari-shi
#>  3 2022_38…       2022 382035              61683 愛媛県    宇和島市  Uwajima-shi
#>  4 2022_38…       2022 382043              37753 愛媛県    八幡浜市  Yawatahama…
#>  5 2022_38…       2022 382051              15734 愛媛県    新居浜市  Niihama-shi
#>  6 2022_38…       2022 382060              63244 愛媛県    西条市    Saijo-shi  
#>  7 2022_38…       2022 382078              37570 愛媛県    大洲市    Ozu-shi    
#>  8 2022_38…       2022 382108              33302 愛媛県    伊予市    Iyo-shi    
#>  9 2022_38…       2022 382132              34781 愛媛県    四国中央市…… Shikokuchu…
#> 10 2022_38…       2022 382141              73676 愛媛県    西予市    Seiyo-shi  
#> 11 2022_38…       2022 382159              24235 愛媛県    東温市    Toon-shi   
#> 12 2022_38…       2022 383562               2195 愛媛県    上島町    Kamijima-c…
#> 13 2022_38…       2022 383864              22823 愛媛県    久万高原町…… Kumakogen-…
#> 14 2022_38…       2022 384011               8634 愛媛県    松前町    Matsumae-c…
#> 15 2022_38…       2022 384020               7042 愛媛県    砥部町    Tobe-cho   
#> 16 2022_38…       2022 384224              27131 愛媛県    内子町    Uchiko-cho 
#> 17 2022_38…       2022 384429              23429 愛媛県    伊方町    Ikata-cho  
#> 18 2022_38…       2022 384844               9089 愛媛県    松野町    Matsuno-cho
#> 19 2022_38…       2022 384887              16550 愛媛県    鬼北町    Kihoku-cho 
#> 20 2022_38…       2022 385069              22931 愛媛県    愛南町    Ainan-cho

Rename the local government code

Note: This feature is available only for data obtained from GeoJSON (Obtaining Data #1).

Convert local government codes into Japanese municipality names for easier management.

dren <- rename_fude(d)
names(dren)
#>  [1] "2022_松山市"     "2022_今治市"     "2022_宇和島市"   "2022_八幡浜市"  
#>  [5] "2022_新居浜市"   "2022_西条市"     "2022_大洲市"     "2022_伊予市"    
#>  [9] "2022_四国中央市" "2022_西予市"     "2022_東温市"     "2022_上島町"    
#> [13] "2022_久万高原町" "2022_松前町"     "2022_砥部町"     "2022_内子町"    
#> [17] "2022_伊方町"     "2022_松野町"     "2022_鬼北町"     "2022_愛南町"

You can also rename the columns to Romaji instead of Japanese.

dren <- d |> rename_fude(suffix = TRUE, romaji = "title")
names(dren)
#>  [1] "2022_Matsuyama-shi"   "2022_Imabari-shi"     "2022_Uwajima-shi"    
#>  [4] "2022_Yawatahama-shi"  "2022_Niihama-shi"     "2022_Saijo-shi"      
#>  [7] "2022_Ozu-shi"         "2022_Iyo-shi"         "2022_Shikokuchuo-shi"
#> [10] "2022_Seiyo-shi"       "2022_Toon-shi"        "2022_Kamijima-cho"   
#> [13] "2022_Kumakogen-cho"   "2022_Matsumae-cho"    "2022_Tobe-cho"       
#> [16] "2022_Uchiko-cho"      "2022_Ikata-cho"       "2022_Matsuno-cho"    
#> [19] "2022_Kihoku-cho"      "2022_Ainan-cho"

Get agricultural community boundary data

Download the agricultural community boundary data, which corresponds to the Fude Polygon data, from the MAFF website: https://www.maff.go.jp/j/tokei/census/shuraku_data/2020/ma/ (available only in Japanese).

b <- get_boundary(d)

Combine Fude Polygons with agricultural community boundaries

You can easily combine Fude Polygons with agricultural community boundaries to create enriched spatial analyses or maps.

GeoJSON data characteristics (obtain data #1)

db <- combine_fude(d, b, city = "松山市", rcom = "由良|北浦|鷲ケ巣|門田|馬磯|泊|御手洗|船越")

library(ggplot2)

ggplot() +
  geom_sf(data = db$fude, aes(fill = rcom_name), alpha = .8) +
  guides(fill = guide_legend(reverse = TRUE, title = "興居島の集落別耕地")) +
  theme_void() +
  theme(legend.position = "bottom") +
  theme(text = element_text(family = "Hiragino Sans"))

出典:農林水産省「筆ポリゴンデータ(2022年度公開)」および「農業集落境界データ(2020年度)」を加工して作成。

Data assignment
  • db$fude: Automatically assigns polygons on the boundaries to a community.
  • db$fude_split: Provides cleaner boundaries, but polygon data near community borders may be divided.
library(patchwork)

fude <- ggplot() +
  geom_sf(data = db$fude, aes(fill = rcom_name), alpha = .8) +
  theme_void() +
  theme(legend.position = "none") +
  coord_sf(xlim = c(132.658, 132.678), ylim = c(33.887, 33.902))

fude_split <- ggplot() +
  geom_sf(data = db$fude_split, aes(fill = rcom_name), alpha = .8) +
  theme_void() +
  theme(legend.position = "none") +
  coord_sf(xlim = c(132.658, 132.678), ylim = c(33.887, 33.902))

fude + fude_split

If you need to adjust this automatic assignment, you will need to write custom code. The rows that require attention can be identified with the following command.

library(dplyr)
library(sf)

db$fude |>
  filter(polygon_uuid %in% (db$fude_split |> filter(duplicated(polygon_uuid)) |> pull(polygon_uuid))) |>
  st_drop_geometry() |>
  select(polygon_uuid, kcity_name, rcom_name, rcom_romaji) |>
  head()
#> # A tibble: 6 × 4
#>   polygon_uuid                         kcity_name rcom_name rcom_romaji
#>   <chr>                                <fct>      <fct>     <fct>      
#> 1 8085bc47-9af5-440f-89e9-f188d3b95746 興居島村   泊        Tomari     
#> 2 26920da0-b63e-4994-a9eb-175e2982fe21 興居島村   門田      Kadota     
#> 3 ac2e7293-6c2f-4feb-a95f-4729dc8d0aec 興居島村   由良      Yura       
#> 4 ea130038-7035-4cf3-b71c-091783090d74 興居島村   船越      Funakoshi  
#> 5 4aba8229-1b14-4eab-8a91-e10d9e841180 興居島村   船越      Funakoshi  
#> 6 156a3459-25cb-494c-824f-9ba6b0fb6f23 興居島村   由良      Yura

FlatGeobuf data characteristics (obtain data #2)

The FlatGeobuf format offers a more efficient alternative to GeoJSON. A notable feature of this format is that each record already includes an accurately assigned agricultural community code.

db2 <- combine_fude(d2, b, city = "松山市", rcom = "由良|北浦|鷲ケ巣|門田|馬磯|泊|御手洗|船越")

ggplot() +
  geom_sf(data = db2$fude, aes(fill = rcom_name), alpha = .8) +
  guides(fill = guide_legend(reverse = TRUE, title = "興居島の集落別耕地")) +
  theme_void() +
  theme(legend.position = "bottom") +
  theme(text = element_text(family = "Hiragino Sans"))

出典:農林水産省「筆ポリゴンデータ(2025年度公開)」および「農業集落境界データ(2020年度)」を加工して作成。

Data enables extraction based on city names, former city names, and agricultural community names.

Note: This feature is available only for data obtained from FlatGeobuf (Obtaining Data #2).

extract_fude(d2, city = "松山市", kcity = "興居島")
#> Simple feature collection with 1691 features and 6 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 132.6373 ymin: 33.87055 xmax: 132.6991 ymax: 33.92544
#> Geodetic CRS:  JGD2000
#> # A tibble: 1,691 × 7
#>    polygon_uuid                   land_type issue_year point_lng point_lat key  
#>  * <chr>                              <dbl>      <dbl>     <dbl>     <dbl> <chr>
#>  1 5a72b4ef-b5f4-465e-9948-e9314…       200       2025      133.      33.9 3820…
#>  2 c69d86d5-1fb2-4528-a87b-155d8…       200       2025      133.      33.9 3820…
#>  3 627134ea-919c-4769-bd94-be16c…       200       2025      133.      33.9 3820…
#>  4 f2631019-d16e-42f9-8501-75f26…       200       2025      133.      33.9 3820…
#>  5 8fedb70d-4bb9-4447-879b-a0eea…       200       2025      133.      33.9 3820…
#>  6 cd235cdf-da51-4ead-ad50-efc6e…       200       2025      133.      33.9 3820…
#>  7 5853b7a1-62c3-4973-9e79-cabd3…       200       2025      133.      33.9 3820…
#>  8 5e090780-6d16-4b9e-aca9-c5622…       200       2025      133.      33.9 3820…
#>  9 90de4abf-e972-4031-987f-f3391…       200       2025      133.      33.9 3820…
#> 10 e5ade914-c803-42d1-9fa8-0921b…       200       2025      133.      33.9 3820…
#> # ℹ 1,681 more rows
#> # ℹ 1 more variable: geometry <MULTIPOLYGON [°]>

Explore Fude Polygon data

You can explore Fude Polygon data interactively.

library(shiny)

s <- shiny_fude(db, rcom = TRUE)
# shiny::shinyApp(ui = s$ui, server = s$server)

Read data from the MAFF database

You can read data from the MAFF database (地域の農業を見て・知って・活かすDB).

b1 <- get_boundary(d2, path = "~", boundary_type = 1)
b2 <- get_boundary(d2, path = "~", boundary_type = 2)
b3 <- get_boundary(d2, path = "~", boundary_type = 3)

m3 <- read_ikasudb(b3, "~/IA0001_2023_2020_38.xlsx")

m1 <- b1 |> 
  read_ikasudb("~/SA1009_2020_2020_38.xlsx") |>
  read_ikasudb("~/GC0001_2019_2020_38.xlsx")

Use the mapview package

If you want to use mapview(), do the following.

db1 <- combine_fude(d, b, city = "伊方町")
db2 <- combine_fude(d, b, city = "八幡浜市")
db3 <- combine_fude(d, b, city = "西予市", kcity = "三瓶|二木生|三島|双岩")

db <- bind_fude(db1, db2, db3)
db$fude <- sf::st_transform(db$fude, crs = 3857)

library(mapview)

mapview(db$fude, zcol = "rcom_name", layer.name = "農業集落名")