Analysis with QGIS: Congressional Gerrymandering?
The purpose of this exercise is to provide further
experience using QGIS by assessing the shapes (and past election data)
of the Congressional Districts to see whether they suggest "gerrymandering".
We'll use QGIS and a shapefile of Congressional Districts.
Specifically, you are asked to:
- Install QGIS from www.qgis.org
(if you have not done so already).
- Download a shapefile dataset of all fifty states' Congressional Districts
from the US Census's
Congressional Boundary files page .
Use the 113th Congress data.
There are 'Zip' files at three
different resolutions / scales are at the bottom of the page.
The 1:5,000,000 scale data in cb_2013_us_cd113_5m.zip
have more detailed geometry than the 1:20,000,000 scale data
in cb_2013_us_cd113_20m.zip . Use either one.
(A good term project would be to compare the results from both.)
- Unzip the shapefile data.
- NEW STUFF... Consider some socioeconomic from the US Census Bureau's
American Community Survey program (ACS3)
and some election data from
May 2015. These data have been re-formated several ways.
is an ASCII text file with: a row of data for each CD; the columns
of data separated by spaces; and 38 rows of description at the top or
'head' of the file. (That is often called a 'header' or 'header
is a colum-regular .CSV file of the same data, but without
header information and with commas added as field seperators.
is a "sidecar" file that gives the data types of the columns in
the .CSV file. It is a list of the kinds of data (integer, string, real)
in the columns of the .CSV file.
Q uses this information to better interpret the .CSV file.
See the link to the tutorial, below.
(1) The "cd113" key field allows the data to join
the 113th congressional districts in the shapefile's table.
(2) IMHO, external 'header', 'sidecar', etc. files much like
the multi-file (.shp, .shx, .dbf, and .prj) 'shapefile' complicate
life by being more files to keep track-of.
- In QGIS...
- display the Congressional Districts.
- compute a measure of district shape "goodness"
such as the ratio of perimeter to area ($perimeter/$area),
or better... an index based on the ratio of perimeter to the
the perimeter of a circle with the asame area as the
district (see below).
- map and examine the outliers on the measure.
- Assess whether it seems like some districts might suggest
"oddities" among the district shapes.
- NEW STUFF... join and map election results of CDs.
- NEW STUFF... compute an index of 'partisanship' for each CD.
- NEW STUFF... see whether there are patterns between the
shape indexes and the partisanship index.
- Hand-in a brief (< 1 page of text plus any maps) report
assessing whether the shapes of these Congressional Districts
The constitutionally mandated purpose of the US Census is to
facilitate our representational form of government.
The total number of US representatives has been set at 435 by
Public Law 62-5 passed in 1911.
Populations change and decenial Census population counts are
used to determine the number of representatives
for each state and to adjust the boundaries for the congressional
districts within the states to reflect those population changes.
The process of setting those boundaries (reapportinment) varies between states.
(Hawaii has a website describing our reapprtionment process
Different approaches may be more or less beneficial to various
political candidates and parties, and has been studied
for some time by political geographers and others.
What criteria should one use in assessing the goodness
of political districts? Shape may be a consideration.
Should districts be "compact" so as to keep all of a
district close to itself (and so maybe similar)? Should
we require "contiguity" so that all of the parts of a district
are connected? But is seems we might also want to consider
the voters in those shapes.
Should districts be designed to include equal
proportions of various demographic groups? Should
the proportions and ratios in each district approximate
those of the districts around them? Or perhaps those of
the whole? Which demographic charactersitics should be
considered? Age? Ethnicity? Employment? Income?
Political affiliation? Past voting patterns?
Other characteristics might also be of interest.
Slicing-up space fairly could get complex.
The US Public Law 94-171 Census Redistricting Data
contains population count by race, by race by age 18 and over,
and by Hispanic/non-Hispanic,
suggesting that more than just population count is used in redistricting.
Let's stay with geometric shape for now, and posit
that we expect compact districts which should be more or less
circular. A circle is compact. A long narrow polygon
(like a worm) is less so. A shape like a starfish is probably in
Morrill (1981, p. 22), cites Bunge's (1966) notion that
a circle should be the standard against which to assess
gerrymandering, and lists several circle-based ratios from
Schwartzberg (1966), quoted below, as measures that might
Morrill discarded most of these as too hard to compute in 1981,
but a modern GIS should make that part relatively easy now.
Calculating areas and perimeters of polygons is simple.
Defining "diameters" and radii may be slightly more cryptic.
- the ratio of the perimeter of the district to the
circumference of a circle of equal area; which will
have a minimum value of 1.0 and values above 1.67
- the ratio of the maximum to the minimum "diameter"
of the district.
- the ratio of the area of the district to the area of a
circle cicumscribed around the area's maximum diameter
- the variance of the distances from the district centroid to
the points on its boundary.
- If you can't or don't want to work with the whole USA
dataset, subset it to a region or state.
- Use the "select by rectangle" tool.
- Drag a seletion rectangle over/around the desired states to select them.
(The rectangle selection tool is an alternative to the Info
- Or use the "select by attribute values" tool in the table
to select a State's congresional districts by FIPS number.
- Export this subset by right clicking the name of data in the
table of contents panel, selecting "Save Selection As...",
and naming a file to hold the subset.
- Remove the original data set from the project.
- Add the subset back into the project.
- You may want to re-project the data to be equal-area or
at least be sure that your GIS is calculating areas in an equal
- Calculate a new data column called "index" in the attribute table.
- Layer -> Open Attribute Table (or right click the layer name in
the table of contents)
- toggle editing "on" with the pencil icon
at the bottom left of the table
- add a data column using the abacus icon.
- name is 'index'
- type is Decimal Number (Real)
- scale and precision of 12 and 6 should do
- Calculate the index as:
$perimeter / (2.0 * $pi * sqrt( $area / $pi))
- Toggle editing "off" (pencil icon) and save your changes.
- Use the sorting and identifing capablities to see what the
range of ratios is and what kinds of shapes typify the
- Make a choropleth map, symbolizing the "index" column.
- Layer -> Properties -> Style
- Column "index"
- Mode "Natural Breaks (Jenks)" or another scheme
- Fix the color ramp... (if you like)
- Color ramp "New color ramp", "Gradient", OK.
- set color 1 as a lighter and color two as a darker version
of the same hue. OK.
- name the new ramp.
- Joining tabular (e.g., .CSV) data to spatial entities is a
very useful GIS capability. It depends on being able to
find 'keys' in the tables to identify the corresponding
records to join. NB Demo in class and expand this hint.
NEW STUFF... This
QGIS Tutorial walks you through how to do a table join in QGIS.
The 'sidecar' file in step 8 is already created for you - it is the
'cd-113-pop-race-inc-elec.cvst' file mentioned above.
- You may want to "zoom" to and print examples to describe in
- Write brief (>1 page + maps) summary of what you discovered
about the shapes of congressional districts.
- Suggestions on how to improve the exercise are welcome.
Morrill, Richard L., 1981.
Political Redistricting and Geographic Theory.
Resource Publications in Geograpy.
Association of American Geographers. Washington DC.
Wang, Sam. "The Great Gerrymander of 2012." New York Times.
3 February 2013. Sunday Review. pp. 1,5.
Hawaii's Elections Office
especially the sections on "REAPPORTIONMENT".
The maps are easier to find than the rationale. I think that the
"deviations" reported in the Summaries are of district populations
from what they should be for equal representation.
This suggests that voter registration and party affiliation are
not considered, right?
"Don't Blame the Maps" Jowei Chen and Jonathan Rodden. NY Times
26 Jan 2014
"Why the Democrats Can't Win" Nate Cohn. NYTimes, Sunday 7 Sept 2014
"The House of Representatives Explained".
Thomas Magstadt, "Dirty Little Family Secret: Elections in the US & UK
Nation of Change May 2015.
"The Millions of Marginalized Americans"
NY Times, Sunday Review, pg 3. 26July2015
Let Math Save Our Democracy NYTimes 5 Dec
2015. Opinion section.
Princeton Election Consortium
[lots of great stuff to digest there]