Quantcast
Channel: CARTO Blog
Viewing all articles
Browse latest Browse all 820

Exploring Congressional Districts using the Data Observatory

$
0
0

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

  1. Create a new table in CartoDB
  2. Rename the table to us_congressional_districts
  3. Rename the name column to geoid
  4. Run the following query:
INSERTINTOus_congressional_districts(the_geom,geoid)SELECTthe_geom,geom_refsFROMOBS_GetBoundariesByGeometry(ST_MakeEnvelope(-179.5,13.4,-42.4,74.4,4326),'us.census.tiger.congressional_district')

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.

10 Smallest Districts

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:

North Carolina Congressional Districts

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:

These were all captured with our Static Maps API from this map.

Use this map and its data by downloading this map’s .carto file from its public page.

What’s next?

Watch our blog for more about the Data Observatory or read more in our introductory post.

Happy open data mapping!


Viewing all articles
Browse latest Browse all 820

Trending Articles