Skip to content

Commit 2ec6edd

Browse files
committed
Added ZCTA geography
For analysis by 5-digit ZIP Code
1 parent 70a9edd commit 2ec6edd

File tree

5 files changed

+141
-1
lines changed

5 files changed

+141
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: cmapgeo
22
Title: R-Friendly Geodata for the Chicago Region
3-
Version: 0.1.0
3+
Version: 0.1.1
44
Authors@R: c(
55
person("Noel", "Peterson",
66
role = c("aut", "cre"),

R/data.R

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,67 @@
203203
"puma_sf"
204204

205205

206+
#' Census ZIP Code Tabulation Areas (ZCTAs)
207+
#'
208+
#' The Census ZCTAs covering the 7-county Chicago Metropolitan Agency for
209+
#' Planning (CMAP) region. From the US Census Bureau's TIGER/Line shapefiles,
210+
#' 2019 vintage.
211+
#'
212+
#' Census Bureau description:
213+
#'
214+
#' *ZIP Code Tabulation Areas (ZCTAs) are approximate area representations of
215+
#' U.S. Postal Service (USPS) five-digit ZIP Code service areas that the Census
216+
#' Bureau creates using whole blocks to present statistical data from censuses
217+
#' and surveys. The Census Bureau defines ZCTAs by allocating each block that
218+
#' contains addresses to a single ZCTA, usually to the ZCTA that reflects the
219+
#' most frequently occurring ZIP Code for the addresses within that tabulation
220+
#' block. Blocks that do not contain addresses but are completely surrounded by
221+
#' a single ZCTA (enclaves) are assigned to the surrounding ZCTA; those
222+
#' surrounded by multiple ZCTAs will be added to a single ZCTA based on limited
223+
#' buffering performed between multiple ZCTAs. The Census Bureau identifies
224+
#' five-digit ZCTAs using a five-character numeric code that represents the most
225+
#' frequently occurring USPS ZIP Code within that ZCTA, and this code may
226+
#' contain leading zeros.*
227+
#'
228+
#' *There are significant changes to the 2010 ZCTA delineation from that used in
229+
#' 2000. Coverage was extended to include the Island Areas for 2010 so that the
230+
#' United States, Puerto Rico, and the Island Areas have ZCTAs. Unlike 2000,
231+
#' when areas that could not be assigned to a ZCTA were given a generic code
232+
#' ending in "XX" (land area) or "HH" (water area), for 2010 there is no
233+
#' universal coverage by ZCTAs, and only legitimate five-digit areas are
234+
#' defined. The 2010 ZCTAs will better represent the actual Zip Code service
235+
#' areas because the Census Bureau initiated a process before creation of 2010
236+
#' blocks to add block boundaries that split polygons with large numbers of
237+
#' addresses using different ZIP Codes.*
238+
#'
239+
#' *Data users should not use ZCTAs to identify the official USPS ZIP Code for
240+
#' mail delivery. The USPS makes periodic changes to ZIP Codes to support more
241+
#' efficient mail delivery. The ZCTAs process used primarily residential
242+
#' addresses and was biased towards ZIP Codes used for city-style mail delivery,
243+
#' thus there may be ZIP Codes that are primarily nonresidential or boxes only
244+
#' that may not have a corresponding ZCTA.*
245+
#'
246+
#' @format
247+
#' A multipolygon `sf` object with `r nrow(zcta_sf)` rows and `r ncol(zcta_sf)`
248+
#' variables:
249+
#' \describe{
250+
#' \item{geoid_zcta}{Unique 5-digit ZCTA ID, corresponding to a 5-digit USPS
251+
#' ZIP Code. Character.}
252+
#' \item{sqmi}{Area in square miles. Double.}
253+
#' \item{geometry}{Feature geometry. `sf` multipolygon.}
254+
#' }
255+
#'
256+
#' @source
257+
#' US Census Bureau
258+
#' [TIGER/Line](https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html)
259+
#'
260+
#' @examples
261+
#' # Display the ZCTAs with ggplot2
262+
#' library(ggplot2)
263+
#' ggplot(zcta_sf) + geom_sf(lwd = 0.1) + theme_void()
264+
"zcta_sf"
265+
266+
206267
#' Illinois State Senate Districts
207268
#'
208269
#' The Illinois General Assembly Senate Districts. From the US Census Bureau's

data-raw/load_census_api.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ ilga_senate_sf <- tigris::state_legislative_districts(state = STATE, house = "up
148148
select(dist_num, dist_name, cmap, sqmi) %>%
149149
arrange(dist_num)
150150

151+
# Process ZIP Code Tabulation Areas (ZCTAs)
152+
zcta_sf <- tigris::zctas(starts_with = "6") %>%
153+
sf::st_transform(cmap_crs) %>%
154+
filter(intersects_cmap(.)) %>% # Restrict to CMAP region
155+
rename(geoid_zcta = GEOID10) %>%
156+
mutate(sqmi = unclass(sf::st_area(geometry) / sqft_per_sqmi)) %>%
157+
select(geoid_zcta, sqmi) %>%
158+
arrange(geoid_zcta)
159+
151160
# Process IDOT regions
152161
county_district = c(
153162
`17031`="D1", `17089`="D1", `17197`="D1", `17043`="D1", `17097`="D1", `17111`="D1",
@@ -184,4 +193,5 @@ usethis::use_data(puma_sf, overwrite = TRUE)
184193
usethis::use_data(congress_sf, overwrite = TRUE)
185194
usethis::use_data(ilga_house_sf, overwrite = TRUE)
186195
usethis::use_data(ilga_senate_sf, overwrite = TRUE)
196+
usethis::use_data(zcta_sf, overwrite = TRUE)
187197
usethis::use_data(idot_sf, overwrite = TRUE)

data/zcta_sf.rda

2.64 MB
Binary file not shown.

man/zcta_sf.Rd

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)