I have a points layer and a polygon layer. I need to count points in each polygon/buffer so that points do not repeat. For instance, here is an example with 4 polygons and 8 points inside in total.
What I get from ArcGIS Summarize Within, as well as from QGIS Count Points in Polygon is that:
- polygon consist of 2 points;
- polygon - 4 points;
- polygon - 2 points;
- polygon - 2 points.
However, the count of 1. and 2. polygon is incorrect because results show 6 points in total even though there are only 4, as you can see in the picture. The result should look something like this:
- polygon consist of 2 points;
- polygon - 2 points;
- polygon - 2 points;
- polygon - 2 points, so that points do not overlap in several polygons.
If I had only a few polygons, this would be quite easy, but as I have several polygons and points, manual work is not a real solution.
I'm pretty sure that this could be done very easily with some expression, however, I could not figure it out.
pyqgis
tag, because no code was demonstrated