Closed Steve-Koller closed 1 year ago
@Steve-Koller it should work with mapview. This is working fine for me:
library(tidycensus)
library(tigris)
options(tigris_use_cache = TRUE)
sf::sf_use_s2(FALSE)
dade_income <- get_acs(
geography = "tract",
variables = "B19013_001",
state = "FL",
county = "Miami-Dade",
geometry = TRUE,
cb = FALSE,
year = 2021
)
dade_income_erase <- erase_water(
dade_income,
area_threshold = 0.95,
year = 2021
)
mapview::mapview(dade_income_erase,
zcol = "estimate",
layer.name = "Median household<br/>income, 2017-2021 ACS")
A couple questions for you:
area_threshold
value? In water-rich areas like Miami, a low value (say, below 0.5) might create very complex polygons that mapview will struggle to draw. output = "wide"
then erasing the water. It'll make the erasing much faster as well!Thank you so much! Bingo- I hadn't been including the below two lines. After adding those in, mapview worked perfectly.
options(tigris_use_cache = TRUE)
sf::sf_use_s2(FALSE)
To your questions:
area_threshold
value (0.95). When using the default 0.75 it took my computer a while to execute, so I increased the threshold value. st_read
to get it into RStudio instead of get_acs
Much appreciated!
I am using the excellent "erase_water" function (thank you for developing!) on a sf object called "MDC_tracts," which is comprised of census tract-level polygons of Miami-Dade County downloaded from tidycensus. The new sf object produced by erase_water, named "MDC_tracts_erased," does not render at all when running the operation
mapview(MDC_tracts_erased)
This stands in contrast to running mapview on the pre-erasure sf object (code below), which runs fine.
mapview(MDC_tracts)
Are sf object outputs from erase_water known to be incompatible with "mapview?" Is there a way to use sf objects that have been altered by "erase_water" with mapview? Thank you!