I have shapefiles with zip code tabulations in Massachusetts and township areas. Some zip codes fall completely within a single township, while some zip codes cross multiple town borders. I want to identify those multi-township zip codes and shade those zip areas differently than the other zips. What I believe I should be doing is joining by location zip polygons that overlap with town polygons. However, the problem with this is that the polygon borders for matching town/zip borders don't align perfectly in the shapefiles, so that every single zip polygon technically "overlaps" every neighboring township polygon, so I can't use this to identify multi-town zips. Does anyone have any advise on the best way to proceed here?

  • ArcGIS has a tool called integrate which will edit data and move lines to be coincident within a distance threshold. I see from this link there is a similar tool in GRASS which I have not tried. gis.stackexchange.com/questions/69425/… – GBG Feb 27 '20 at 18:10
  1. Do a polygon overlay between the two layers using the QGIS Intersection algorithm (available in the Processing Toolbox).
  2. Open the resulting layer and its attribute table and

    1. Use the field calculator to create new fields containing the area (formula: $area - under Geometry) and perimeter (formula: $perimeter - under Geometry) of each polygon.
    2. either

      a) Select the areas that are larger than a certain size (use the minimum size you expect for a "proper" overlap).

      b) Use the field calculator to calculate the area / perimeter, and use that new field (and the area and perimeter fields if you like) in a select expression to get rid of typical "sliver" polygons (the ratio between area and parameter is small - very elongated polygons, and the total area is typically small).

    3. Use the QGIS Statistics by Categories algorithm (available in the Processing Toolbox) on the selected features (Selected features only), grouping (Field(s) with categories) on zip code - those with a value larger than 1 in the count column of the resulting table are "multi-township".

  • Thank you! This is an elegant solution to the problem. – AlJones1816 Mar 10 '20 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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