Reputation: 11
I am looking to download land area (e.g. square meters) data for U.S. counties from the U.S. Census Bureau. I can't seem to find this data on the census website. Has anyone been able to find this data in the past?
On the TIGERweb site, I found the data that I am looking for, but it is broken down by state. Ideally, I'd be able to download the data for all counties in a single file.
https://tigerweb.geo.census.gov/tigerwebmain/TIGERweb2020_counties_census2010.html
Thanks for the help!
I have tried various searches on the U.S. Census website but have not had any luck finding land area data.
Upvotes: 0
Views: 1272
Reputation: 1061
Use the tigris package. The counties()
function returns a column, ALAND
, that gives you land area in square meters.
library(tigris)
us_counties <- counties(cb = TRUE)
us_counties %>%
dplyr::select(county = NAMELSAD,
state = STATE_NAME,
land_area = ALAND,
water_area = AWATER)
Simple feature collection with 3234 features and 4 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: -179.1489 ymin: -14.5487 xmax: 179.7785 ymax: 71.36516
Geodetic CRS: NAD83
First 10 features:
county state land_area water_area
1 Riley County Kansas 1579077672 32047392
2 Ringgold County Iowa 1386932347 8723135
3 Carbon County Montana 5303728455 35213028
4 Bear Lake County Idaho 2527123155 191364281
5 Buffalo County Wisconsin 1750290818 87549529
6 York County Nebraska 1482794063 8595055
7 Eagle County Colorado 4362754228 18970639
8 Westmoreland County Pennsylvania 2661762744 21294228
9 Le Flore County Oklahoma 4116554962 49752941
10 Burnet County Texas 2576525880 69856136
geometry
1 MULTIPOLYGON (((-96.96095 3...
2 MULTIPOLYGON (((-94.47167 4...
3 MULTIPOLYGON (((-109.7987 4...
4 MULTIPOLYGON (((-111.6345 4...
5 MULTIPOLYGON (((-92.08384 4...
6 MULTIPOLYGON (((-97.82629 4...
7 MULTIPOLYGON (((-107.1137 3...
8 MULTIPOLYGON (((-79.90487 4...
9 MULTIPOLYGON (((-95.05996 3...
10 MULTIPOLYGON (((-98.45924 3...
Upvotes: 0
Reputation: 1121
You can get this data from the U.S. Census Bureau: Gazetteer Files > Counties: https://www.census.gov/geographies/reference-files/time-series/geo/gazetteer-files.html
Click "Download the National Counties Gazetteer File" to download the zip file, and uncompress it to get a (tab-delineated) table containing information about all counties (or county-equivalent areas) for all 50 states, District of Columbia, and Puerto Rico. See columns ALAND_SQMI and AWATER_SQMI for the land and water area respectively (in square miles).
Or, if you're on linux (or macOS), download the specific file (at least as of today, 2023-07-31) in a few lines:
wget "https://www2.census.gov/geo/docs/maps-data/data/gazetteer/2022_Gazetteer/2022_Gaz_counties_national.zip" -O tmp.zip
unzip -p tmp.zip > 2022_Gaz_counties_national.txt
rm -f tmp.zip
Then if you want to just have simple data frame with the area of each county, in R (since you tagged this with R):
df_gaz_counties <- read.delim("2022_Gaz_counties_national.txt")
df_select <- df_gaz_counties[c("USPS","NAME","ALAND_SQMI","AWATER_SQMI")]
Now df_select
has the info you want. Here's the first 6 rows (printed with head(df_select)
) to demonstrate:
USPS NAME ALAND_SQMI AWATER_SQMI
1 AL Autauga County 594.455 9.914
2 AL Baldwin County 1589.863 437.410
3 AL Barbour County 885.008 19.507
4 AL Bibb County 622.470 3.696
5 AL Blount County 644.891 5.738
6 AL Bullock County 622.815 2.328
Upvotes: 2