Skip to main content

Census States

census/tiger/state holds one row for each of the 50 states, the District of Columbia, Puerto Rico and the four Island Areas: American Samoa, Guam, the Northern Mariana Islands and the US Virgin Islands. It has one partition per vintage year of the TIGER/Line state file. The defs.yaml lists the vintages.

DealerDemographicsComponent reads state and region to set each dealer's census_region.

Source​

The attribute table (.dbf) of the TIGER/Line state and equivalent entity shapefile, https://www2.census.gov/geo/tiger/TIGER<year>/STATE/tl_<year>_us_state.zip. Appendix Q of the TIGER/Line Shapefiles Technical Documentation gives its record layout. No API key is needed.

The zip is about 10 MB, nearly all of it the state outlines. The asset reads only the 11 KB .dbf member, with the same HTTP range requests as census/tiger/tabblock20.

The file gives regions and divisions as codes. Table 6-4 of the Geographic Areas Reference Manual names them, and ai_public.sources.census.states holds those names. Puerto Rico and the Island Areas have region code 9 and division code 0. They are in no region or division.

Columns​

ColumnTypeMeaning
geo_idString2-digit state FIPS code (STATEFP), the first two digits of a tract or block GEOID
stateStringUSPS abbreviation (STUSPS)
nameStringState name (NAME)
regionStringCensus Bureau region (REGION): Northeast, Midwest, South or West; null for Puerto Rico and the Island Areas
divisionStringCensus Bureau division (DIVISION), such as South Atlantic; null for Puerto Rico and the Island Areas
land_area_m2, water_area_m2Float64Land and water area in square meters (ALAND, AWATER)
latitude, longitudeFloat64The state's internal point (INTPTLAT, INTPTLON), NAD83
yearInt64The vintage year
_partitionStringThe vintage year, the partition key

Checks​

Reading the file raises ValueError when:

  • a STATEFP is not two digits, or a STUSPS not two capital letters;
  • two rows have the same STATEFP or the same STUSPS;
  • a REGION code is neither a Table 6-4 region code nor 9, or a DIVISION code is neither a Table 6-4 division code nor 0;
  • a state or DC is missing, or is in no region or division;
  • a row other than a state or DC is in a region or division.

Adding a vintage​

  1. Add the year to years in projects/ai_public/src/ai_public/defs/census/state/defs.yaml and materialize its partition.
  2. Add the year to partition_keys of the census/tiger/state entry in each consuming location's external/defs.yaml, so that location's spec has the producer's partitions.
  3. Set states_vintage_year of each DealerDemographicsComponent that should read the new vintage. The component's states input reads only that partition.