Skip to content

aclu-national/us-congress-districts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

US Congress District Shapes

An aggregation of data modeling the United States Congress district boundaries, including a full history of past districts.

File format

GeoJSON, in the style of Who's On First records (pretty-printed, properties sorted alphabetically, with the geometry last). Note that records lack a Who's On First numeric ID; these records have not been imported into the Who's On First gazetteer (yet), I am just using the WOF encoding style.

File paths

The directory structure and filename are constructed using the following:

  • 2-char state (e.g., ca for California, or dc for District of Columbia, from Python's us package)
  • When the district started, by congressional session
  • When the district ended, by congressional session
  • District number (0 refers to at-large, -1 is for "shapes describing Indian territories within states during the 18th and early 19th centuries," from Lewis, et al.)
data/[state]/[state]_[start session]_to_[end session]_[district].[display|lookup].geojson

For example, the 1st congressional district for Idaho, from the 66th to 89th session is saved at these locations:

data/id/id_66_to_89_1.lookup.geojson
data/id/id_66_to_89_1.display.geojson

The two versions correspond to:

  • .lookup.geojson includes the original geometry
  • .display.geojson includes a simplified geometry

The simplified geometries are optimized for end-user display, and take up less space. We use Mapshaper for simplification (mapshaper -filter-islands min-area=500000 -simplify resolution=300).

Building from scratch

You can rebuild the data from the original sources, by using make data.

Spatialite index

You can build a SQLite/Spatialite index with: make spatialite.

PostGIS index

You can build a PostgreSQL/PostGIS index with: make postgis.

Database URL

The database configuration is controlled by the DATABASE_URL environment variable.

export DATABASE_URL="sqlite://us-congress.db"

For PostGIS:

export DATABASE_URL="postgres://user:pass@hostname/dbname"

Or a simpler version, for local PostGIS development:

export DATABASE_URL="postgres://dbname"

Dependencies

Sources