diff --git a/data_prep/R/census_tract_2022.R b/data_prep/R/census_tract_2022.R index e3c07e7e..3a552356 100644 --- a/data_prep/R/census_tract_2022.R +++ b/data_prep/R/census_tract_2022.R @@ -93,6 +93,14 @@ temp_sf <- harmonize_projection(temp_sf) gc() + +# remove lagoa dos patos e mirim +temp_sf <- subset(temp_sf, code_muni != 430000100000000) +temp_sf <- subset(temp_sf, code_muni != 430000200000000) + + + + # harmonize and save save_state <- function(code_uf){ # code_uf <- 33 @@ -102,10 +110,11 @@ save_state <- function(code_uf){ # code_uf <- 33 temp_sf2 <- subset(temp_sf, code_state == code_uf) # temp_sf2 <- subset(temp_sf, code_muni == '3304557') + temp_sf2 <- fix_topoly(temp_sf2) + # convert to MULTIPOLYGON temp_sf2 <- to_multipolygon(temp_sf2) - temp_sf2 <- fix_topoly(temp_sf2) # simplify temp_sf_simplified <- simplify_temp_sf(temp_sf2, tolerance = 10) @@ -123,10 +132,10 @@ all_states <- unique(temp_sf$code_state) # Apply function to save the data gc(reset = T) -# tictoc::tic() -# future::plan(strategy = 'multisession') -# furrr::future_map(.x=all_states, .f=save_state, .progress = T) -# tictoc::toc() +tictoc::tic() +future::plan(strategy = 'multisession') +furrr::future_map(.x=all_states, .f=save_state, .progress = T) +tictoc::toc() tictoc::tic()