# Exploring Congressional Districts using the Data Observatory

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:

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:

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

To create similar or even better visualizations, you can watch our Data Observatory webinar as many times as you need to!

## What’s next?

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

Happy open data mapping!

Andy Eschbacher is a data scientist at CARTO, where he integrates data science solutions into CARTO's infrastructure, solves spatial data science problems for clients, and builds out tools to better enable people working at the intersection of data science and GIS.

• ## PostGIS 3.0.0 Just Released

Most of our users are aware that under the hood, CARTO runs on PostgreSQL and PostGIS. In fact, when it comes to contributing to PostGIS, we are the most active organizatio...