Japan Census Shapefiles

library(jpucd)

This package includes shapefiles for local census districts in Ibaraki Prefecture covering the six censuses. These as well as shapefiles for all prefectures can also be downloaded from e-Stat.

Original files

The original shapefiles are in kmz format wrapped in a zip file. The first task is to extract and convert these to geojson. A kmz file is a zipped kml file so the first step is to unzip twice.

Copies of the original files for Ibaraki Prefecture are in extdata.

list.files(system.file("extdata",package="jpucd"))
#>  [1] "A002005212000DDKWC08.zip"                     
#>  [2] "A002005522009DDKWC08.zip"                     
#>  [3] "A002005522014DDKWC08.zip"                     
#>  [4] "JPGen2005CTeconCY2009P08Ibaraki.geojson"      
#>  [5] "JPGen2005CTeconCY2014P08Ibaraki.geojson"      
#>  [6] "JPGen2005CTgenlCY2000P08Ibaraki.geojson"      
#>  [7] "JPGen2005CTgenlCY2005P08Ibaraki.geojson"      
#>  [8] "JPGen2005CTgenlCY2010P08Ibaraki.geojson"      
#>  [9] "JPGen2005CTgenlCY2015P08Ibaraki.geojson"      
#> [10] "TsukubaExpressCensusDistricts2000.geojson"    
#> [11] "TsukubaExpressCensusDistricts2005.geojson"    
#> [12] "TsukubaExpressCensusDistricts2010.geojson"    
#> [13] "TsukubaExpressCensusDistricts2015.geojson"    
#> [14] "TsukubaExpressEconCensusDistricts2009.geojson"
#> [15] "TsukubaExpressEconCensusDistricts2014.geojson"

openkmzzip places the contained kml file in the R temp file folder and returns its path.

library(jpucd)
library(zip)
#> 
#>  次のパッケージを付け加えます: 'zip'
#>  以下のオブジェクトは 'package:utils' からマスクされています: 
#> 
#>      unzip, zip
shppath <- system.file("extdata",package="jpucd")
shpfile <- paste(shppath,list.files(shppath,pattern=".zip")[1],sep="/")
kmlfile <- openkmzzip(shpfile)
#>  要求されたパッケージ fs をロード中です

Currently, the external data contains the following files:

File name Format Census type Census year Prefecture Notes
A002005212000DDKWC08.zip Zipped kml General 2000 Ibaraki Original file from eStat
A002005522009DDKWC08.zip Zipped kml Economic 2009 Ibaraki Original file from eStat
A002005522014DDKWC08.zip Zipped kml Economic 2014 Ibaraki Original file from eStat
JPgenlCY2000P08Ibaraki.geojson.zip Zipped geojson General 2000 Ibaraki Converted from eStat file
JPgenlCY2005P08Ibaraki.geojson.zip Zipped geojson General 2005 Ibaraki Converted from eStat file
JPgenlCY2010P08Ibaraki.geojson.zip Zipped geojson General 2010 Ibaraki Converted from eStat file
JPgenlCY2015P08Ibaraki.geojson.zip Zipped geojson General 2000 Ibaraki Converted from eStat file

Extended data - Original general census files from eStat

These Japanese census shapefiles conform to KML 2.2. Each Placemark element contains ExtendedData that is particularly useful for identifying placemarks and can be used for developing mappings from postal addresses to census districts.

Field Typical value Description
KEY_CODE 082010010 Census district id code, 9 or 11 digits
PREF 08 Prefecture
CITY 201 Municipality. May be city, ward (in Tokyo), village, etc
S_AREA 001000 Subarea - first 4 digits at cho-oaza level, last 2 at chome-aza level
PREF_NAME 茨城県 Name of prefecture in Japanese
CITY_NAME 水戸市 Name of municipality
S_NAME 青柳町 Name of subarea
KIGO_E E1 Flag for districts that have multiple shapes. (See note below.)
HCODE 8101
AREA 2327255.25 Area district in square meters
PERIMETER 9591.49414 Perimeter of area
h12kaxx_ 803
h12kaxx_ID 802
KEN 08 Number of prefecture
KEN_NAME 茨城県 Name of prefecture
SITYO_NAME
DUMMY1
GST_NAME 水戸市
CSS_NAME
KIHON1 0010 Cho-aza level code
DUMMY2 -
KIHON2 00 Chome-aza level code
KEYCODE1 201001000
DUMMY3
KEYCODE2 2010010
AREA_MAX_F M
KIGO_D
N_KEN
N_CITY
N_C1 0
KIGO_I
TATE 0
DIR 0
HIGHT 50 Height in meters
JIKAKU 10
NMOJI 3 Number of characters in MOJI
DUMMY4
MOJI 青柳町 Name of subarea
SEQ_NO2 802
KSUM 20
CSUM 22
JINKO 2366 Population
SETAI 877 Number of households
X_CODE 140.480499
Y_CODE 36.392635
KCODE1 0010-00

Notes:

  1. KEY_CODE

KEY_CODE is a unique id for the census district and can be used to relate geojson shapes to district data extracted to a separate csv file. To make into a usable id, 9-digit codes needed to be zero-padded to 11 digits. The full 11-digit code is a concatenation of PREF, CITY, KIHON1 and KIHON2 codes. The KEY_CODE field in eStat shapefiles has severe quality control issues. In this project, unique ids are created by concatenating the digit “1”, PREF, CITY, KIHON1 and KIHON2 fields. The digit “1” serves as a version code; unified districts replace this with the digit “2”.

  1. S_NAME

S_NAME is usually the geographic name of the district but has issues. This field is not standardized across prefectures and is particularly problematic in Kyoto Prefecture. Named districts may contain other named districts whose names are not in this extended data. These names apparently derive from folder names used by local census offices to manage census tasks.

  1. KIGO_E

KIGO_E flags districts with multiple shapes. Shapes are labeled E1, E2, etc. District stats such as population are gathered under shape E1.

Extended data - Original economic census files from eStat

Shapefiles for the economic census generally correspond to those of the general census. However, enumeration at the cho-oaza and chome-koaza levels differs. If there are no chome-koaza sublevels, the final 6 digits of S_AREA and AZA_CODE are idential to the first 6 digits. If there are sublevels, the first 6 digits indicate the cho-oaza level and the last 6 digits designate the sublevel. For the first sublevel of the set, the last and first 6 digits are identical.

Field Typical value Description
KEY_CODE 082010000000018 Census district id code, 15 digits
PREF 08 Prefecture
CITY 201 Municipality. May be city, ward (in Tokyo), village, etc
S_AREA 001600001800 Subarea - first 6 digits at cho-oaza level, last 6 at chome-aza level
PREF_NAME 茨城県 Name of prefecture in Japanese
CITY_NAME 水戸市 Name of municipality
S_NAME 泉町3丁目 Name of subarea
KIGO_E Flag for districts that have multiple shapes. (See note below.)
AREA 62497.287 Area district in square meters
PERIMETER 1029.752 Perimeter of area in meters
KEN 08 Number of prefecture
KEN_NAME 茨城県 Name of prefecture
CSS_NAME 水戸市
MOJI 泉町3丁目 Name of subarea
AZA_CODE 001600001800 Cho-aza level code
AREA_MAX_F M
KIGO_D
N_KEN
N_CITY
N_C1 0
KIGO_I
JIGYOSHO 180
JUGYOSHA 2109
X_CODE 140.46115
Y_CODE 36.37999
KEYCODE1 2010000000018

Notes:

  1. KEY_CODE

KEY_CODE is an id for the census district and can be used to relate geojson shapes to district data extracted to a separate csv file. It may not be unique but can be made unique in combination with KIGO_E.

  1. S_NAME

  2. KIGO_E

KIGO_E flags districts with multiple shapes. Shapes are labeled E1, E2, etc. District stats such as population are gathered under shape E1.