Skip to content

Commit

Permalink
use simplify_temp_sf(tolerance = 10) for census tracts
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr committed Mar 26, 2024
1 parent f48f1cc commit 12ae76a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions data_prep/R/census_tract_2022.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@ temp_sf <- harmonize_projection(temp_sf)

save_state <- function(code_uf){ # code_uf <- 11

temp_sf2 <- subset(temp_sf, code_state == code_uf)
temp_sf2 <- subset(temp_sf, code_state == code_uf)

# temp_sf2 <- subset(temp_sf2, code_muni == '3304557')
# temp_sf2 <- subset(temp_sf2, code_muni == '3304557')




# convert to MULTIPOLYGON
temp_sf2 <- to_multipolygon(temp_sf2)
# convert to MULTIPOLYGON
temp_sf2 <- to_multipolygon(temp_sf2)

# simplify
temp_sf_simplified <- simplify_temp_sf(temp_sf2)
# simplify
temp_sf_simplified <- simplify_temp_sf(temp_sf2, tolerance = 10)

# Save cleaned sf in the cleaned directory
sf::st_write(temp_sf2, paste0(dest_dir, code_uf,".gpkg") )
sf::st_write(temp_sf_simplified, paste0(dest_dir, code_uf,"_simplified.gpkg"),)
# Save cleaned sf in the cleaned directory
# sf::st_write(temp_sf2, paste0(dest_dir, code_uf,".gpkg") )
sf::st_write(temp_sf_simplified, paste0(dest_dir, code_uf,"_simplified.gpkg"))

}
}


all_states <- unique(temp_sf$code_state)
Expand Down
2 changes: 1 addition & 1 deletion r-package/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Imports:
sf (>= 0.9-3),
utils
Suggests:
censobr,
censobr (>= 0.3.2),
covr,
dplyr (>= 0.8-3),
ggplot2 (>= 3.3.1),
Expand Down

0 comments on commit 12ae76a

Please sign in to comment.