Skip to content

Commit

Permalink
working on census tracts 2022
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr committed Jul 29, 2024
1 parent 81c4fd6 commit 7b8c2f7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions data_prep/R/census_tract_2022.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit 7b8c2f7

Please sign in to comment.