Type: Package
Title: Utilities for 'Kokudo Suuchi'
Version: 1.0.0
Description: Provides utilities for 'Kokudo Suuchi', the GIS data service of the Japanese government. See https://nlftp.mlit.go.jp/index.html for more information.
URL: https://yutannihilation.github.io/kokudosuuchi/, https://github.com/yutannihilation/kokudosuuchi
BugReports: https://github.com/yutannihilation/kokudosuuchi/issues
License: MIT + file LICENSE
Depends: R (≥ 2.10)
Imports: glue, rlang, sf, stringr, tibble
Suggests: testthat
LazyData: TRUE
RoxygenNote: 7.1.1
Encoding: UTF-8
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2021-02-23 13:53:58 UTC; yutani
Author: Hiroaki Yutani ORCID iD [aut, cre]
Maintainer: Hiroaki Yutani <yutani.ini@gmail.com>
Repository: CRAN
Date/Publication: 2021-02-23 14:50:02 UTC

Utilities for 'Kokudo Suuchi'

Description

Provides utilities for 'Kokudo Suuchi', the GIS data service of the Japanese government. See <https://nlftp.mlit.go.jp/index.html> for more information.

Author(s)

Maintainer: Hiroaki Yutani yutani.ini@gmail.com (ORCID)

See Also

http://nlftp.mlit.go.jp/ksj/api/about_api.html


Get JPGIS2.1 Data

Description

getKSJData() is deprecated.

Usage

getKSJData(zip_file, cache_dir = tempdir(), encoding = "CP932")

Arguments

zip_file

Either a URL, a path to a zip file, or a path to a directory which contains shape files.

cache_dir

Path to a directory for caching zip files.

encoding

Encoding of the data.


Rest in peace, 'Kokudo Suuchi' API...

Description

Rest in peace, 'Kokudo Suuchi' API...

Usage

getKSJSummary(...)

getKSJURL(...)

choose_prefecture_code(...)

Arguments

...

Ignored.


Read JPGIS2.1 Data

Description

readKSJData() is an utility to read data downloaded from 'Kokudo Suuchi' service.

Usage

readKSJData(x, encoding = "CP932")

Arguments

x

A path to a ZIP file or to a directory that contains the extracted files.

encoding

Encoding of the data.

Examples

## Not run: 
# Download a ZIP file from kokudosuuchi website
zip_file <- tempfile(fileext = ".zip")
url <- "https://nlftp.mlit.go.jp/ksj/gml/data/W07/W07-09/W07-09_3641-jgd_GML.zip"
download.file(url, zip_file)

# Load all data as sf objects
d <- readKSJData(zip_file)

# Translate colnames and 'codelist' type columns
translateKSJData(d)

## End(Not run)


Translate JPGIS2.1 Data

Description

translateKSJData() translates colnames and 'codelist'-type of columns to human-readable labels.

Usage

translateKSJData(
  x,
  id = NULL,
  variant = NULL,
  quiet = TRUE,
  translate_colnames = TRUE,
  translate_codelist = TRUE
)

Arguments

x

A list of sf objects.

id

An ID of the dataset (e.g. A03). This can be NULL if x is loaded by readKSJData().

variant

A type of variant in case the translation cannot be determined only by id.

quiet

If TRUE, suppress messages.

translate_colnames

If TRUE, translate colnames to human-readable labels.

translate_codelist

If TRUE, translate codes to human-readable labels.