Package 'jpndistrict'

Title: Create Japanese Administration Area and Office Maps
Description: Utilizing the data that Japanese administration area provided by the National Land Numerical Information download service (<https://nlftp.mlit.go.jp/ksj/index.html>). This package provide map data is based on the Digital Map 25000 (Map Image) published by Geospatial Information Authority of Japan (Approval No.603FY2017 information usage <https://www.gsi.go.jp>).
Authors: Shinya Uryu [aut, cre] , Geospatial Information Authority of Japan [dtc] (This package data sets, National Land numerical information by the Geographical Survey Institute with the approval of Geographical Survey Institute Head (Approval No.603FY2017 information usage))
Maintainer: Shinya Uryu <[email protected]>
License: MIT + file LICENSE
Version: 0.3.9.9000
Built: 2024-11-08 04:43:57 UTC
Source: https://github.com/uribo/jpndistrict

Help Index


Reform input jis code as 2 or 5 character length.

Description

Reform input jis code as 2 or 5 character length.

Usage

code_reform(jis_code)

Arguments

jis_code

jis code for prefecture and city identifical number. If prefecture, must be from 1 to 47. If city, range of 5 digits.

Note

The code_reform function was added in version 0.3.2.9000

Examples

code_reform(c(1, "33", "08201"))

Administration code validation

Description

Administration code validation

Usage

code_validate(jis_code)

Arguments

jis_code

jis code for prefecture and city identifical number. If prefecture, must be from 1 to 47. If city, range of 5 digits.

Note

The code_validate function was added in version 0.3.2.9000

Examples

code_validate(jis_code = "05")
code_validate(jis_code = 33101)
code_validate(jis_code = c("01", "33101"))

Collect administration area

Description

Collect administration area

Usage

collect_cityarea(path = NULL)

Arguments

path

path to N03 shapefile (if already exist)


Collect administration office point datasets.

Description

Collect administration office point datasets.

Usage

collect_ksj_p34(path = NULL)

Arguments

path

path to P34 shapefile (if already exist)


Get prefecture code (JIS X 0402)

Description

Get prefecture code from prefecture of name or number.

Usage

collect_prefcode(code = NULL, admin_name = NULL)

Arguments

code

numeric

admin_name

prefecture code for Japanese (character)


District Viewer

Description

Interactive district map and information tool.

Usage

district_viewer(color = "red")

Arguments

color

polygon line color for leaflet

Examples

## Not run: 
district_viewer()

## End(Not run)

Detect city by coordinates

Description

Detect city by coordinates

Usage

find_city(longitude, latitude, geometry = NULL, ...)

Arguments

longitude

longitude

latitude

latitude

geometry

XY sfg object

...

export parameter to other functions

Note

The find_city function was added in version 0.3.0

Examples

find_city(longitude = 140.1137418, latitude = 36.0533957)

# Referenced by sf geometry
library(sf)
find_city(geometry = st_point(c(136.6833, 35.05)))

Find JIS city code

Description

Find JIS city code

Usage

find_jis_code(pref_code, admin_name, strict = TRUE)

Arguments

pref_code

jis code from 1 to 47

admin_name

prefecture names (string)

strict

matching patterns

Value

Identification code for cities, towns and villages (JIS X 0402:2010)

Examples

find_jis_code(33, intToUtf8(c(20489, 25975, 24066), multiple = FALSE))
find_jis_code(33, enc2native(intToUtf8(c(20489, 25975, 24066),
                                       multiple = FALSE)),
                                       strict = FALSE)
find_jis_code(14,
c(enc2native(intToUtf8(c(37772, 20489, 24066), multiple = FALSE)),
  enc2native(intToUtf8(c(23567, 30000, 21407, 24066), multiple = FALSE))), strict = FALSE) # nolint

Detect prefecture by coordinates

Description

Detect prefecture by coordinates

Usage

find_pref(longitude, latitude, geometry = NULL, ...)

Arguments

longitude

longitude

latitude

latitude

geometry

XY sfg object

...

export parameter to other functions

Note

The find_pref function was added in version 0.3.0

Examples

## Not run: 
find_pref(longitude = 130.4412895, latitude = 30.2984335)

# Referenced by sf geometry
library(sf)
find_pref(geometry = st_point(c(130.4412895, 30.2984335)))

## End(Not run)

Detect prefectures by coordinates

Description

Detect prefectures by coordinates

Usage

find_prefs(longitude, latitude, geometry = NULL)

Arguments

longitude

longitude

latitude

latitude

geometry

XY sfg object

Examples

find_prefs(longitude = 122.940625, latitude = 24.4520833334)
find_prefs(longitude = 140.1137418, latitude = 36.0533957)

# Referenced by sf geometry
library(sf)
find_pref(geometry = st_point(c(136.6833, 35.05)))

Simple features for administration office points

Description

Name and geolocations for administration offices in prefecture.

Usage

jpn_admins(jis_code)

Arguments

jis_code

jis code for prefecture and city identifical number. If prefecture, must be from 1 to 47. If city, range of 5 digits.

Value

data.frame. contains follow columns jis_code, type, name, address, longitude and latitude.

Examples

## Not run: 
jpn_admins(jis_code = 17)

## End(Not run)

Simple features for city area polygons

Description

City area polygon data. When an administrative name (jis_code_city) or code (jis_code_city) is specified as an argument, the target city data is extracted. If neither is given, it becomes the data of the target prefecture.

Usage

jpn_cities(jis_code, admin_name)

Arguments

jis_code

jis code for prefecture and city identifical number. If prefecture, must be from 1 to 47. If city, range of 5 digits.

admin_name

administration name

Examples

jpn_cities(jis_code = "08",
  admin_name = intToUtf8(c(12388, 12367, 12400, 24066)))

jpn_cities(jis_code = 33103)
jpn_cities(jis_code = "33103")
jpn_cities(jis_code = c(33103, 33104, 33205))
jpn_cities(jis_code = c(33103, 34107))

Simple features for prefecture area polygon

Description

Prefecture polygon data.

Usage

jpn_pref(
  pref_code,
  admin_name,
  district = TRUE,
  download = FALSE,
  drop_sinkyokyoku = TRUE
)

Arguments

pref_code

jis code from 1 to 47

admin_name

prefecture names (string)

district

logical (default TRUE)

download

logical (default FALSE). IF TRUE, return raw data.

drop_sinkyokyoku

if TRUE, drop sichyo_sinkyokyoku variable (default TRUE)

Details

Collect unit of prefecture simple feature data.frame objects.. If download argument is TRUE, download administrative area data from the National Land Numeral Information Download Service (for law data).

Examples

## Not run: 
jpn_pref(pref_code = 33, district = FALSE)
jpn_pref(pref_code = 14, district = TRUE)

## End(Not run)

Prefectural informations in Japan

Description

Prefectures dataset.

Usage

jpnprefs

Format

A data frame with 47 rows 11 variables:

  • jis_code: jis code

  • prefecture: prefecture names

  • capital: capital name for prefecture

  • region: region

  • major_island:

  • prefecture_en:

  • capital_en:

  • region_en:

  • major_island_en:

  • capital_latitude: latitude for catital

  • capital_longitude: longitude for catital


Export district's mesh polygon

Description

Export district's mesh polygon

Usage

mesh_district(jis_code = NULL, to_mesh_size = NULL)

Arguments

jis_code

jis code for prefecture and city identifical number. If prefecture, must be from 1 to 47. If city, range of 5 digits.

to_mesh_size

target mesh type. From 80km to 1km as numeric.

Examples

mesh_district(jis_code = "33101", to_mesh_size = 80)
mesh_district(jis_code = "05", to_mesh_size = 80)

Download KSJ N03 zip files

Description

Download KSJ N03 zip files

Usage

path_ksj_cityarea(code = NULL, path = NULL)

Arguments

code

prefecture code (JIS X 0402)

path

path to N03 shapefile (if already exist)


Prefecture's meshcode

Description

Prefectures dataset.

Usage

prefecture_mesh

Format

A simple feature data frame with 314 rows 5 variables:

  • prefcode: prefecture code

  • meshcode

  • name

  • type

  • geometry


Intermediate function

Description

Intermediate function

Usage

raw_bind_cityareas(pref)

Arguments

pref

sf object (prefecture)


Intermediate function

Description

Download N03 raw data files or loading if file exists.

Usage

read_ksj_cityarea(code = NULL, path = NULL)

Arguments

code

prefecture code (JIS X 0402)

path

path to N03 shapefile (if already exist)


Intermediate function

Description

Intermediate function

Usage

read_ksj_p34(pref_code = NULL, path = NULL)

Arguments

pref_code

prefecture code (JIS X 0402)

path

path to P34 shapefile (if already exist)


Internal function

Description

Internal function

Usage

which_pol_min(longitude, latitude, ...)

Arguments

longitude

longitude

latitude

latitude

...

export parameter to other functions