diff --git a/app.R b/app.R index 04477b6..f085db5 100644 --- a/app.R +++ b/app.R @@ -25,21 +25,25 @@ names(racine) <- racines$codlib racine <- racine[racine %in% GHM$GHM] rm(racines) -# Lecture codes postaux <-> codes insee et garder ceux existants ---- -read_csv2("insee.csv", col_types = cols(INSEE = col_character())) %>% - select(Codepos, insee = INSEE) %>% - mutate(insee = insee %>% str_pad(5, "left", "0")) %>% - filter(Codepos %in% GHM$Codepos) -> insee +# # Lecture codes postaux <-> codes insee et sauvegarde carte pour simplification avec mapshaper +# read_csv2("insee.csv", col_types = cols(INSEE = col_character())) %>% +# select(Codepos, insee = INSEE) %>% +# mutate(insee = insee %>% str_pad(5, "left", "0")) -> insee +# # Lecture carte et join avec codes postaux ---- +# readOGR("communes", "communes-20150101-100m") -> communes +# communes@data %>% +# left_join(insee) -> communes@data +# rm(insee) +# communes <- communes[!is.na(communes$Codepos),] +# writeOGR(communes, "communes_byCP", "communes_byCP", driver = "ESRI Shapefile") + +# Lecture carte ---- +readOGR("communes_byCP", "communes_byCP") -> communes + +# Filtre Codes existants dans la base +communes <- communes[communes$Codepos %in% GHM$Codepos,] +communes@data$Codepos <- communes@data$Codepos %>% as.character -# Lecture carte et join avec codes postaux ---- -readOGR("communes", "communes-20150101-simpl") -> communes - -communes@data %>% - left_join(insee) -> communes@data - -communes <- communes[!is.na(communes$Codepos),] - -rm(insee) # long/lat de chaque commune ---- diff --git a/communes_byCP/communes_byCP.dbf b/communes_byCP/communes_byCP.dbf new file mode 100644 index 0000000..25b0037 Binary files /dev/null and b/communes_byCP/communes_byCP.dbf differ diff --git a/communes_byCP/communes_byCP.prj b/communes_byCP/communes_byCP.prj new file mode 100644 index 0000000..a30c00a --- /dev/null +++ b/communes_byCP/communes_byCP.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/communes_byCP/communes_byCP.shp b/communes_byCP/communes_byCP.shp new file mode 100644 index 0000000..0e2f075 Binary files /dev/null and b/communes_byCP/communes_byCP.shp differ diff --git a/communes_byCP/communes_byCP.shx b/communes_byCP/communes_byCP.shx new file mode 100644 index 0000000..ea4a486 Binary files /dev/null and b/communes_byCP/communes_byCP.shx differ