I'm trying to use the U.S. Census shapefiles to figure out what census blocks make up which state legislative districts. I decided to test the method on a state where I already had this data to see if it was working, and it isn't. QGIS assigned a district to each Census Block, but it was often the wrong one. I'm looking for any help figuring out a good way to get this information.

The process I used was I turned the census blocks into centroids, turned the centroids into stratified random points, joined the original census block shapefile with the random points, then joined this with the state House shapefile. I also tried just doing a spatial join between the block and legislative shapefiles, but had the same problem.

  • Centroids may or may not fall within their source polygon, and randomizing them could further spread them away from their parent polygons. Not at all surprised you're getting incorrect matches. I think what you're looking to do is Union the two layers. Note that if a block is split by a district boundary, you'd get two entries for that block. If you want to ensure just one match, you could convert block polys to a point within rather than a centroid (there's a way to do it in QGIS around here somewhere). Still no guarantee it'd be the right district depending on how mismatched boundaries are.
    – Chris W
    Apr 3, 2015 at 21:00

2 Answers 2


The Census geographies follow a strict hierarchy. Doing this as a simple attribute join using a link table will be much faster than doing it as a spatial join, and, as you have discovered also more accurate. As Chris W points, centroid do not always fall inside a polygon (think of a crescent or donut shape), and this is why you are ending up with incorrect matches.

The Census Bureau provides this data in the Census Block Assignment Files. Unfortunately this download page requires you to download the BAF by state. I was not able to find it in one national file, although I would not be surprised if someone has already done that somewhere. Also, if you already have an entire Census database somewhere, you could extract the relationships yourself from the GEOHEADER table.

When you download a state, you will get a ZIP with 9 files, each one being a table linking from the blocks to a specific geography. The ones you will be interested in are the ones ending in SLDU and SLDL which stand for State Legislative District Upper/Lower. The head of the SLDU for Iowa looks like this:


It's not completely clear from your question if your goal is to have a spatial output of the blocks with attached legislative districts, or if you were just using QGIS to do a spatial join because you couldn't find the BAF. In any event, from your question, it is clear that you have the knowledge to do the join on your own, so I am not going to elaborate unless you need additional assistance.


Unfortunately, I am unable to find the data for this outside of Minnesota.

For Minnesota, the state GIS office provided me an Excel file with two columns - one with the census block number, and it's corresponding precinct (or VTD) number (like 27010029, or something like that). Then I merged that file with another Excel file that had columns for precincts/VTDs and another column for Legislative Districts. This massive, 256,000-row file connects all blocks to their respective State House and State Senate districts. I can email you this file by request.

Here is where you can obtain the shapefiles for VTDs and Census Blocks: http://www.gis.leg.mn/html/download.html - scroll down to the "Census Data" for the block-level shapefiles (which also features block-by-block race/ethnicity data) -look for "Political Boundaries" for VTD (precinct) boundaries

  • Thanks! Are these the current state legislative districts? Apr 3, 2015 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.