I have a points shapefile and a polygon shapefile.

Using QGIS, I would like to select all the polygons which have one or more points in them, however, one condition should be considered, that if one point lies in two or more polygons which overlays, only one polygon is selected.

Please see picture for example. There are 3 polygons highlighted with orange circle with only one point in them. As the polygons overlay, the result I obtained from ArcGIS Summarize Within tool showed that each of these polygons consist of one point, which is wrong, cause there are not 3 points, but 1. There should be only one polygon with one point, the other one stays empty.

enter image description here

The result should look something like this. Orange points are selected polygons with one or more points. And pay attention to black line - these are polygons which overlays and shares a point, but only one of them are selected. Of course this could be done manually, but it's too time consuming and it gets hard when there are to many overlaying polygons, so I try to find a fast way to do this.

enter image description here

There is a very similar question at Selecting polygons which contain at least one point with spatial index using PyQGIS about at least one and more points in polygon, but the solution selects all polygons with intersection, even if they overlay and share a common point.

I couldn't find the solution with "Join attributes by location" or "Select attributes by location". I'm probably missing something and this should be done easily.

How do I do this using QGIS?


3 Answers 3


Using QGIS (since version 3.16, for older version see refFunctions plugin), you can use the expressions overlay expressions:

  1. Use Menu Processing / Toolbox / Geometry by Expression, select the points layer as input and create a new polygon with this expression - it will create a new layer containing only the polygons you want (only one per point, even if the point is inside several polygons). The advantage of this solution is that it works whatever shape the polygons have, it can be irregular shapes as well. I chose circle as you have circles as well. You only have to change polygons to the name of your polygon layer:
    collect_geometries (
  1. Now use select by location and set the original polygon layer as input, select the equal checkbox and select the created geometry in step 1 for input in By comparing to the features from

enter image description here


All your circles have the same radius if I see it well. Therefore a methodological (nearly perfect) workaround to this issue is:

  • create the centroid of each circle
  • make a spatial join between the points and their closest centroid. So you have the ID of the closest polygon and the distance between the centroid
  • joint the attribute table of the points resulting from the spatial join with the original circles (without keeping non matching rows) and select only the circles where the distance to centroid is smaller than the radius.

That's nearly it, but you still have one problem when more than one point are contained by more than one polygon. In this case AND if the points are closest to different centroid, you might still have some overlapping polygons. The rule then depends on precisely what you want to do.

IMHO this makes more sense than the iterative loop which would select circles based on their database order. If the circles don't have the same radius it is slightly more complex but it remains manageable after computing the circle radius in the attribute table.


A second workaround is to simply select all polygons that overlap with a point, then remove polygons in excess by thanks to the "no overlapping polygon" solution. Very good answer here with ArcMap Finding and deleting overlapping polygons using ArcMap

This will guarantee that you don't have any overlap, but unlike my other answer you don't control which circle you keep or not. Maybe you can combine the two answers to manage the exception that is not taken into account by the centroid rule.

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.