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

  • 1
    The electoral divisions that share a boundary with the electoral areas are not completely within the electoral areas, hence not being selected. Does intersects work as you wish? For associating the attributes, you will probably want to look into Join attributes by location, rather than making a selection.
    – Matt
    Mar 16, 2022 at 16:27
  • 1
    PostGIS has a covers operator that should do this, but it seems that select by location doesn't
    – Ian Turton
    Mar 16, 2022 at 17:23
  • 1
    You can intersect them, sort by area, delete duplicates. Join the electoral columns back to the original divisions
    – BERA
    Mar 16, 2022 at 18:00

3 Answers 3


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 (
    overlay_nearest (
        buffer ($geometry, 1)
  • polygon on line 4 is the name of the electoral areas
  • 1 on line 5 is the buffer's distance
  • 1
    won't that select the neighbouring areas (i.e. just outside the polygon) too?
    – Ian Turton
    Mar 16, 2022 at 17:17
  • 1
    Shouldn't, if the buffer is small enough that the neighboring polygons are not covered completely (thus not completely within). Can't test it right now.
    – Babel
    Mar 16, 2022 at 18:10
  • Sorry, thought you used intersects
    – Ian Turton
    Mar 16, 2022 at 19:05

I recommend installing the Select Within Plugin. It has the option to select the polygons where their centroids are located inside the polygons of the other layer.

enter image description here

Using this option, you can avoid any duplicates that occur when using the intersect predicate inside the Select by location tool.


One possible path is to create a new attribute with the centroids of the smaller areas, and then select all the points that are inside the larger polygon.

  • Thanks! Tried this and it worked for ~99% of the EDs, the rest I could get manually.
    – user202393
    Mar 22, 2022 at 20:54

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.