I'm trying to intersect the shapefiles for US congressional districts and US counties. I can intersect manually (Vector->Geoprocessing Tools->Intersect) or with python (processing.runalg('qgis:intersection', input, input2, output)). Here's a picture of my goal:

enter image description here

My problem is that my output file seems to have rows for each boundary intersection, eg. between the left triangle and the square. I get duplicates in the output file, where the area of the intersection is really tiny, and sometimes a county has the state name of its neighboring state (with which it shares a border).

I don't want to keep line intersections like this, only the polygon intersections. How can I do this in QGIS?

  • 1
    You could filter by area, and/or by the ratio perimeter/area (to exclude extremely long but narrow polygons, which have a big area).
    – JGH
    Commented Sep 13, 2017 at 22:51

1 Answer 1


The problem is that the shapefiles have rough boundaries that don't line up perfectly. When intersected, this produces observations with tiny areas.

My solution was just to drop (when cleaning the data in python) any observations with area smaller than the smallest district (my level of observation).

Another option is to set a negative buffer, which will drop most of the small area intersections. For this, you need to figure out an appropriate buffer size by trial and error.

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.