Public dataset · Geography, weather and climate
US Geographic Boundaries in BigQuery
Polygons (GEOGRAPHY) for US states, counties, ZIP code areas, metro areas, congressional districts, urban areas, coastline and railways, plus state and county adjacency lists. 16 tables, 2 GiB, almost all of it geometry: leave the geometry column out and most queries cost under 2 MiB.
Each table holds one kind of US boundary as a GEOGRAPHY column (state_geom, county_geom, zip_code_geom and so on) with an interior point for labels and the standard identifiers: FIPS codes (state_fips_code, county_fips_code), geo_id, LSAD and MTFCC feature class codes, and land and water area in square metres. The identifier columns use US Census Bureau coding, which makes it easy to join boundaries to the American Community Survey or any other FIPS-keyed data.
Tables: states, counties, zip_codes, cbsa (metro and micro areas), csa, metropolitan_divisions, cnecta, congress_district_115 and congress_district_116, urban_areas, nws_forecast_regions, coastline, railways, national_outline, and the non-spatial adjacent_states and adjacent_counties.
The dataset has no description in its metadata. Most tables are partitioned by ingestion time and clustered on identifier or geometry columns, as listed below.
Tables and sizes
| Table | Rows | Size | Full scan | Layout |
|---|---|---|---|---|
zip_codes | 33,791 | 1.2 GiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: zip_code_geom, state_code, state_name, county |
urban_areas | 3,601 | 194 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: lsad_name, type |
counties | 3,233 | 182 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: state_fips_code, county_name, csa_fips_code, cbsa_fips_code |
railways | 130,086 | 106 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: full_name, mtfcc_feature_class_code |
congress_district_115 | 444 | 93.1 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: state_fips_code, functional_status, lsad_name |
congress_district_116 | 444 | 92.0 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: state_fips_code, functional_status, lsad_name |
cbsa | 938 | 74.6 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: csa_geo_id, msa_indicator |
nws_forecast_regions | 3,853 | 57.3 MiB | under $0.01 | None |
coastline | 4,248 | 35.8 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: name |
csa | 175 | 26.4 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: name, lsad_name |
states | 56 | 21.3 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: state, state_name, region_code, division_code |
metropolitan_divisions | 31 | 4.6 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: name, csa_code, cbsa_code |
cnecta | 7 | 1.0 MiB | under $0.01 | Partitioned: Ingestion time (_PARTITIONTIME), daily · Clustered: name_lsad, name, cnecta_fips_code, geo_id |
national_outline | 1 | 726 KiB | under $0.01 | None |
adjacent_counties | 3,217 | 588 KiB | under $0.01 | None |
adjacent_states | 49 | 4.1 KiB | under $0.01 | None |
Example queries
Which state and county contain a point
Reverse geocoding with ST_CONTAINS against state and county polygons (the point is downtown Chicago). The dry run is an upper bound because both tables are clustered.
SELECT
s.state_name,
c.county_name
FROM `bigquery-public-data.geo_us_boundaries.states` AS s
JOIN `bigquery-public-data.geo_us_boundaries.counties` AS c
ON s.state_fips_code = c.state_fips_code
WHERE ST_CONTAINS(s.state_geom, ST_GEOGPOINT(-87.6298, 41.8781))
AND ST_CONTAINS(c.county_geom, ST_GEOGPOINT(-87.6298, 41.8781));ZIP code areas in one state with SELECT * (expensive)
Pulls zip_code_geom for every ZIP: 1.15 GiB, the full table.
SELECT *
FROM `bigquery-public-data.geo_us_boundaries.zip_codes`
WHERE state_code = 'NY';ZIP code areas in one state without geometry (cheap)
Same rows, no geometry columns: 1.6 MiB, about 700 times less.
SELECT
zip_code,
city,
county,
ROUND(area_land_meters / 1e6, 1) AS land_km2
FROM `bigquery-public-data.geo_us_boundaries.zip_codes`
WHERE state_code = 'NY'
ORDER BY land_km2 DESC;Neighbouring states
adjacent_states is a plain lookup table; no spatial functions needed.
SELECT
state_name,
neighbors_state
FROM `bigquery-public-data.geo_us_boundaries.adjacent_states`
WHERE state = 'TN';Largest states by land area
Uses the precomputed area_land_meters instead of ST_AREA on the polygons.
SELECT
state_name,
ROUND(area_land_meters / 1e6) AS land_km2,
ROUND(area_water_meters / 1e6) AS water_km2
FROM `bigquery-public-data.geo_us_boundaries.states`
ORDER BY land_km2 DESC
LIMIT 10;Querying it cheaply
- Geometry is almost the whole size:
zip_codesis 1.15 GiB, but its non-geometry columns for one state are 1.6 MiB. Select geometry only when you run a spatial function on it. - Use the stored
area_land_metersand interior point columns (int_point_lat,internal_point_geom) instead of computingST_AREAorST_CENTROIDon large polygons. - Most tables are clustered. Dry runs on clustered tables return an upper bound; the bytes actually billed can be lower when filters match the clustering columns. See clustered tables.
- Spatial joins against
zip_codesorurban_areasare slot-heavy even when the bytes are small. Filter bystate_fips_codefirst so fewer polygons are compared.
FAQ
How much does it cost to query US boundaries in BigQuery?
The whole dataset is 2 GiB, so no query can scan more. Queries that skip geometry columns usually bill the 10 MB minimum. Polygon queries on zip_codes or counties scan up to 1.15 GiB and 182 MiB.
Is the geo_us_boundaries dataset free?
Google pays for storing public datasets, so you never pay storage for them. You pay only for the bytes your queries scan, billed to your own project at the on-demand rate, and the first 1 TiB scanned each month is free. See BigQuery pricing.
How do I find which county a latitude and longitude is in?
Use ST_CONTAINS(county_geom, ST_GEOGPOINT(longitude, latitude)) on the counties table. Note that ST_GEOGPOINT takes longitude first.
Related datasets
All public datasets · BigQuery cost queries · Pricing calculator
