This script performs a spatial join between TAZ centroids and U.S. Census tracts in Utah to assign each TAZ to its corresponding Census Tract GEOID. The result is exported as a CSV for further geographic or demographic analysis.
- Imports core libraries:
pandas
,numpy
,matplotlib
,os
- Uses
arcgis
Python API for spatial operations - Sets working and results directories
- Tract shapefile:
tl_2018_49_tract.shp
- TAZ centroids shapefile:
TAZCentroids.shp
- Loads shapefiles into Spatially Enabled DataFrames (
sdf
) - Verifies and sets correct spatial reference (
EPSG:26912
) - Performs spatial join: assigns each TAZ centroid to a Census Tract polygon
- Extracts key fields:
TAZID
and matchedGEOID
- Saves result as: