extract_blocks() extracts the blocks that intersect the
boundary of a locality. It has two arguments: the state key
(cve_edo) and the name of the locality
(locality). It returns a list with two sf objects:
locality (the boundary of the locality) and
block.
Only the file of the requested state is downloaded.
ggplot() +
geom_sf(data = merida$block, fill = "#E01A59", col = "white", lwd = 0.05) +
geom_sf(data = merida$locality, fill = NA, col = "black", lwd = 0.3) +
theme_void()gdl <- extract_blocks(cve_edo = "14",
locality = c("Guadalajara", "Zapopan", "Tonalá", "Tlaquepaque"))
nrow(gdl$block)
#> [1] 39830ggplot() +
geom_sf(data = gdl$block, fill = "#E01A59", col = "white", lwd = 0.05) +
geom_sf(data = gdl$locality, fill = NA, col = "black", lwd = 0.3) +
theme_void()The same steps the function does: