The Data Observatory contains a wealth of information available for exploration and data augmentation. In this post we will look at an available dataset provided by the U.S. Census that is very much in the news: United States Congressional Districts.
First let's retrieve all of the U.S. Congressional Districts and display them in a map. Using the function
OBS_GetBoundariesByGeometry we can populate a table with all of the geometries. We can find the tag we need for getting the districts from the [Data Observatory's catalog].
Steps to Create a Congressional District Map
- Create a new table in CartoDB
- Rename the table to
- Rename the
- Run the following query:
INSERT INTO us_congressional_districts(the_geom geoid) SELECT the_geom geom_refs FROM OBS_GetBoundariesByGeometry( ST_MakeEnvelope(-179.5 13.4 -42.4 74.4 4326) 'us.census.tiger.congressional_district') ##_END_REPLACE_ME_PRE_##
If you switch to 'Map View' you'll see the United States covered in congressional districts. Now we can start exploring.
Where are the 10 smallest districts?
Here New York City takes the cake.
It has 9 of the top 10 smallest congressional districts by area. Number 10 is in the center of Los Angeles. If you're interested in recreating this [see] the SQL I used.
Where are the 10 largest districts?
Unsurprisingly we find that Alaska is the largest congressional district followed by Montana Wyoming and large chunks of other western states. I re-projected the data into a more compact format so it is easier to see all of the congressional districts in one view.
See the [SQL I used] to create that map. Or just download the .carto file on that map's public page.
10 potentially gerrymandered districts
The geometries of congressional districts are often in the news because of accusations of gerrymandering. The Washington Post highlights several districts which have highly irregular shapes (i.e. they're not compact in a mathematical sense). We list them here!
North Carolina's 1st 4th and 12th districts have long extended shapes that span large areas of the state:
Chicago has a district the shape of ear muffs:
Maryland's 3rd district wends all across the central parts of the state as does Pennsylvania's 7th:
Texas' 21st and 33rd districts and Louisiana's 2nd:
Finally Florida's 5th district:
Use this map and its data by downloading this map's .carto file from its public page.
To create similar or even better visualizations you can watch our Data Observatory webinar as many times as you need to!
Happy open data mapping!