Skip to content
This repository has been archived by the owner on Jan 30, 2021. It is now read-only.

Prototype codes #9

Closed
yutannihilation opened this issue Sep 7, 2017 · 4 comments
Closed

Prototype codes #9

yutannihilation opened this issue Sep 7, 2017 · 4 comments

Comments

@yutannihilation
Copy link
Owner

library(dplyr)

readr::read_csv("codes.csv") %>% 
  filter(stringr::str_detect(.data$code, "X|~|~")) %>%
  knitr::kable() %>% 
  clipr::write_clip()
identifier table_num name code type note
A22-m 3 各年度別最深積雪 A22_01XXXX 実数型(Real) XXXX:西暦
A22-m 4 各年度別累計降雪量 A22_02XXXX 実数型(Real) XXXX:西暦
A22-m 5 各年度別最低気温 A22_03XXXX 実数型(Real) XXXX:西暦
A22-m 6 各年度別平均風速 A22_04XXXX 実数型(Real) XXXX:西暦
A22-m 7 雪害 A22-m-14_SnowDisaster_XX 曲面型(GM_Surface) XX:都道府県コード
A22-m 8 各年別死者数 A22_10XXXX 整数型(Integer) XXXX:西暦
A22-m 8 各年別行方不明者数 A22_11XXXX 整数型(Integer) XXXX:西暦
A22-m 8 各年別重傷者数 A22_12XXXX 整数型(Integer) XXXX:西暦
A22-m 8 各年別軽傷者数 A22_13XXXX 整数型(Integer) XXXX:西暦
A22-m 8 各年別住家全壊棟数 A22_14XXXX 整数型(Integer) XXXX:西暦
A22-m 8 各年別住家半壊棟数 A22_15XXXX 整数型(Integer) XXXX:西暦
A22-m 8 各年別住家一部破損数 A22_16XXXX 整数型(Integer) XXXX:西暦
A22-m 8 各年別除雪ボランティア団体数 A22_17XXXX 整数型(Integer) XXXX:西暦
A22-m 8 各年別除雪ボランティア登録人数 A22_18XXXX 整数型(Integer) XXXX:西暦
A22-m 8 各年別除雪ボランティア活動回数 A22_19XXXX 整数型(Integer) XXXX:西暦
A22-m 8 各年別除雪ボランティアの延べ参加人数 A22_20XXXX 整数型(Integer) XXXX:西暦
A35b 1 景観地区・準景観地区(面) A35d-14_XX 曲面型(GM_Surface) XX:都道府県コード
A35b 1 景観地区・準景観地区(点) A35e-14_XX 点型(GM_Point) XX:都道府県コード
A35b 3 景観地区・準景観地区ゾーン A35f-14_XX 曲面型(GM_Surface) XX:都道府県コード
A35c 1 景観重要建造物 A35g-14_XX 点型(GM_Point) XX:都道府県コード
A35c 3 景観重要樹木 A35h-14_XX 点型(GM_Point) XX:都道府県コード
A37 8 各年別救急車出動件数 A37_34XXXX 整数型(Integer) ※XXXX:該当年の西暦
A37 8 各年別消防防災ヘリ出動件数 A37_35XXXX 整数型(Integer) ※XXXX:該当年の西暦
A37 8 各年別平均現場到着所要時間 A37_36XXXX 実数型(Real) ※XXXX:該当年の西暦
A37 8 各年別平均病院収容時間 A37_37XXXX 実数型(Real) ※XXXX:該当年の西暦
P15 2 取扱品目1~15 P15_019~033 文字列型(CharacterString) NA
P16 2 備考1-12 P16_015~026 文字列型(CharacterString) NA
P17 2 管轄範囲(1~n) P17_006~ 文字列型(CharacterString) NA
P18 2 管轄範囲(1~n) P18_006~ 文字列型(CharacterString) NA
P33 1 集客施設 P33-14 XX 点型(GM_Point) XX:都道府県コード
@yutannihilation
Copy link
Owner Author

yutannihilation commented Sep 7, 2017

  • XXXX is a year
  • XX is a prefecture code
  • n~m can be translated as seq(n, m)
  • n~ seems at most 26
sf_data <- getKSJData("http://nlftp.mlit.go.jp/ksj/gml/data/P17/P17-12/P17-12_01_GML.zip", cache_dir = "../kokudosuuchi/cached_zip")
colnames(sf_data$`P17-12_01_FireStationJurisdiction`)
#>  [1] "P17_005"  "P17_006"  "P17_007"  "P17_008"  "P17_009"  "P17_010"  "P17_011"  "P17_012"  "P17_013"  "P17_014" 
#> [11] "P17_015"  "P17_016"  "P17_017"  "P17_018"  "P17_019"  "P17_020"  "P17_021"  "P17_022"  "P17_023"  "P17_024" 
#> [21] "P17_025"  "P17_026"  "geometry"

sf_data <- getKSJData("http://nlftp.mlit.go.jp/ksj/gml/data/P18/P18-12/P18-12_01_GML.zip", cache_dir = "../kokudosuuchi/cached_zip")
colnames(sf_data$`P18-12_01_PoliceStationJurisdiction`)
#>  [1] "P18_005"  "P18_006"  "P18_007"  "P18_008"  "P18_009"  "P18_010"  "P18_011"  "P18_012"  "P18_013"  "P18_014" 
#> [11] "P18_015"  "P18_016"  "P18_017"  "P18_018"  "P18_019"  "P18_020"  "geometry"

@yutannihilation
Copy link
Owner Author

最深積雪
(A22-m-14_MaxSnowDepth_XX)
XX:都道府県コード

These are prototypes for layer names. Ignore for now.

@yutannihilation
Copy link
Owner Author

XXXX should be treated specially. For example:

library(dplyr)
library(kokudosuuchi)

sf_data <- getKSJData(
  "http://nlftp.mlit.go.jp/ksj/gml/data/A22-m/A22-m-14/A22-m-14_01_GML.zip",
  cache_dir = "../kokudosuuchi/cached_zip",
  translate_colnames = FALSE
)

sf_data$`A22-m-14_MaxSnowDepth_01` %>%
  rename(avg = A22_010001, max_depth = A22_010002) %>%
  tidyr::gather(key = "year", value = "yearly_max_depth", starts_with("A22_01")) %>%
  mutate(year = stringr::str_extract(year, "(?<=A22_01)\\d{4}")) %>%
  split(.year)

@yutannihilation
Copy link
Owner Author

Close this for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant