QGIS Selecting Electoral Division – Selecting All Electoral Divisions Within Local Electoral Area in QGIS

overlapping-featurespolygonqgisselect-by-locationwithin

I have two vector layers:

  • electoral divisions (blue)(similar to counties)
  • local electoral areas (green outline) (similar to states).

I'd like to select all EDs 'within' a state using 'Select by Location' however 'within' doesn't select the EDs which touch the borders of the LEA (see selected EDs in yellow).

I'd eventually like to export the attribute table as a lookup detailing the EDs that sit within each LEA.

Selected ED within LEA

Best Answer

Use select by expression with this expression. It creates a small buffer around the electoral areas to be sure that all electoral divisions are completely within:

within (
    $geometry,
    overlay_nearest (
        'polygon',
        buffer ($geometry, 1)
    )[0]
)
  • polygon on line 4 is the name of the electoral areas
  • 1 on line 5 is the buffer's distance
Related Question