読者です 読者をやめる 読者になる 読者になる

地球地図日本のデータをRで読んだ時のメモ

地球地図というのがあるらしい。データの中身がさっぱりわからないので調べてメモ。

元データ

元データ:http://www.gsi.go.jp/kankyochiri/gm_jpn.html
仕様書http://www.iscgm.org/gm/spec/gmspec-2.1.pdf

結果

library(rgdal)

f <- "C:\\path\\to\\gm-jpn-bnd_u_2_1"

ogrListLayers(f)
#> [1] "coastl_jpn"  "polbnda_jpn" "polbndl_jpn"
#> attr(,"driver")
#> [1] "ESRI Shapefile"
#> attr(,"nlayers")
#> [1] 3

20ページあたり。

  • coastl: The line where a land mass is in contact with a body of water
  • polbndl: A line of demarcation between controlled areas
  • polbnda: An area controlled by administrative authority

とりあえずpolbndaを読んでみる。

l <- readOGR(f, layer = "polbnda_jpn", encoding = "UTF-8",verbose = TRUE)
glimpse(l@data)
#> Observations: 2,914
#> Variables: 9
#> $ f_code   (fctr) FA001, FA001, FA001, FA001, FA001, FA001, FA001, FA001, FA001, FA001, FA001, FA001, FA001, FA001, FA001, FA001, FA0...
#> $ coc      (fctr) JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, ...
#> $ nam      (fctr) Hokkai Do, Hokkai Do, Hokkai Do, Hokkai Do, Hokkai Do, Hokkai Do, Hokkai Do, Hokkai Do, Hokkai Do, Hokkai Do, Hokka...
#> $ laa      (fctr) Sapporo Shi, Hakodate Shi, Otaru Shi, Asahikawa Shi, Muroran Shi, Kushiro Shi, Kushiro Shi, Obihiro Shi, Kitami Shi...
#> $ pop      (int) 1930496, 274485, 127224, 349057, 91276, 180160, -89999999, 169104, 123401, 9801, 87284, 38240, 23451, 174469, 37248,...
#> $ ypc      (int) 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 20...
#> $ adm_code (fctr) 01100, 01202, 01203, 01204, 01205, 01206, 01206, 01207, 01208, 01209, 01210, 01211, 01212, 01213, 01214, 01214, 012...
#> $ salb     (fctr) UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, UNK, ...
#> $ soc      (fctr) JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, JPN, ...
  • f_code: FACC feature code
  • coc: Country code
  • nam: State/Province/Prefecture name
  • laa: Local administrative area name
  • pop: Population
  • ypc: Year of population census
  • adm_code: Administrative code
  • salb: SALB(Second Administrative Level Boundaries) code(c.f. Core Geo-Database | UNGIWG
  • soc: Source Country or VMA

UNKUnknownらしい。