| 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] (ORCID: <https://orcid.org/0000-0002-0493-6186>), 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: | 2026-05-14 06:10:32 UTC |
| Source: | https://github.com/uribo/jpndistrict |
Reform input jis code as 2 or 5 character length.
code_reform(jis_code)code_reform(jis_code)
jis_code |
jis code for prefecture and city identifical number. If prefecture, must be from 1 to 47. If city, range of 5 digits. |
The code_reform function was added in version 0.3.2.9000
code_reform(c(1, "33", "08201"))code_reform(c(1, "33", "08201"))
Administration code validation
code_validate(jis_code)code_validate(jis_code)
jis_code |
jis code for prefecture and city identifical number. If prefecture, must be from 1 to 47. If city, range of 5 digits. |
The code_validate function was added in version 0.3.2.9000
code_validate(jis_code = "05") code_validate(jis_code = 33101) code_validate(jis_code = c("01", "33101"))code_validate(jis_code = "05") code_validate(jis_code = 33101) code_validate(jis_code = c("01", "33101"))
Collect administration area
collect_cityarea(path = NULL)collect_cityarea(path = NULL)
path |
path to N03 shapefile (if already exist) |
Collect administration office point datasets.
collect_ksj_p34(path = NULL)collect_ksj_p34(path = NULL)
path |
path to P34 shapefile (if already exist) |
Get prefecture code from prefecture of name or number.
collect_prefcode(code = NULL, admin_name = NULL)collect_prefcode(code = NULL, admin_name = NULL)
code |
numeric |
admin_name |
prefecture code for Japanese (character) |
Interactive district map and information tool.
district_viewer(color = "red")district_viewer(color = "red")
color |
polygon line color for leaflet |
## Not run: district_viewer() ## End(Not run)## Not run: district_viewer() ## End(Not run)
Detect city by coordinates
find_city(longitude, latitude, geometry = NULL, ...)find_city(longitude, latitude, geometry = NULL, ...)
longitude |
longitude |
latitude |
latitude |
geometry |
XY sfg object |
... |
export parameter to other functions |
The find_city function was added in version 0.3.0
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_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
find_jis_code(pref_code, admin_name, strict = TRUE)find_jis_code(pref_code, admin_name, strict = TRUE)
pref_code |
jis code from 1 to 47 |
admin_name |
prefecture names (string) |
strict |
matching patterns |
Identification code for cities, towns and villages (JIS X 0402:2010)
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) # nolintfind_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
find_pref(longitude, latitude, geometry = NULL, ...)find_pref(longitude, latitude, geometry = NULL, ...)
longitude |
longitude |
latitude |
latitude |
geometry |
XY sfg object |
... |
export parameter to other functions |
The find_pref function was added in version 0.3.0
## 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)## 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
find_prefs(longitude, latitude, geometry = NULL)find_prefs(longitude, latitude, geometry = NULL)
longitude |
longitude |
latitude |
latitude |
geometry |
XY sfg object |
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)))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)))
Name and geolocations for administration offices in prefecture.
jpn_admins(jis_code)jpn_admins(jis_code)
jis_code |
jis code for prefecture and city identifical number. If prefecture, must be from 1 to 47. If city, range of 5 digits. |
data.frame. contains follow columns jis_code, type, name, address, longitude and latitude.
## Not run: jpn_admins(jis_code = 17) ## End(Not run)## Not run: jpn_admins(jis_code = 17) ## End(Not run)
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.
jpn_cities(jis_code, admin_name)jpn_cities(jis_code, admin_name)
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 |
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))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))
Prefecture polygon data.
jpn_pref( pref_code, admin_name, district = TRUE, download = FALSE, drop_sinkyokyoku = TRUE )jpn_pref( pref_code, admin_name, district = TRUE, download = FALSE, drop_sinkyokyoku = TRUE )
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) |
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).
## Not run: jpn_pref(pref_code = 33, district = FALSE) jpn_pref(pref_code = 14, district = TRUE) ## End(Not run)## Not run: jpn_pref(pref_code = 33, district = FALSE) jpn_pref(pref_code = 14, district = TRUE) ## End(Not run)
Prefectures dataset.
jpnprefsjpnprefs
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
mesh_district(jis_code = NULL, to_mesh_size = NULL)mesh_district(jis_code = NULL, to_mesh_size = NULL)
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. |
mesh_district(jis_code = "33101", to_mesh_size = 80) mesh_district(jis_code = "05", to_mesh_size = 80)mesh_district(jis_code = "33101", to_mesh_size = 80) mesh_district(jis_code = "05", to_mesh_size = 80)
Download KSJ N03 zip files
path_ksj_cityarea(code = NULL, path = NULL)path_ksj_cityarea(code = NULL, path = NULL)
code |
prefecture code (JIS X 0402) |
path |
path to N03 shapefile (if already exist) |
Prefectures dataset.
prefecture_meshprefecture_mesh
A simple feature data frame with 314 rows 5 variables:
prefcode: prefecture code
meshcode
name
type
geometry
Intermediate function
raw_bind_cityareas(pref)raw_bind_cityareas(pref)
pref |
sf object (prefecture) |
Download N03 raw data files or loading if file exists.
read_ksj_cityarea(code = NULL, path = NULL)read_ksj_cityarea(code = NULL, path = NULL)
code |
prefecture code (JIS X 0402) |
path |
path to N03 shapefile (if already exist) |
Intermediate function
read_ksj_p34(pref_code = NULL, path = NULL)read_ksj_p34(pref_code = NULL, path = NULL)
pref_code |
prefecture code (JIS X 0402) |
path |
path to P34 shapefile (if already exist) |
Internal function
which_pol_min(longitude, latitude, ...)which_pol_min(longitude, latitude, ...)
longitude |
longitude |
latitude |
latitude |
... |
export parameter to other functions |