I have a 'POINT' layer named export_bdd with a field called denom. Many of the points overlap because they are saved at the same coordinates.
For each record where denom = 'Teuc pseu', I want to search within a 10-meter buffer zone for the number of entities where denom = 'Teuc pseu'.
To do this, I tried the following expression before applying any filters:
CASE WHEN denom = 'Teuc pseu' THEN array_length( overlay_intersects(@layer, buffer($geometry, 10))) ELSE 0 END However, the results are always incorrect. The number of entities found is not right, and it doesn't change regardless of the buffer size (whether 0.0001 or 1,000,000 meters, the result is the same).
Do you know what might be going wrong?
Example:
I choose a random point :
You can see in the last field on the right, the result of my expression above returned 2. On the picture, we can see that more features are located within the 10m. And here is the attribute table :
My expression should return 30 instead of 2 (before I apply a filter on denom).
Here is also a link to download the layer: Test layer
I tried with a new project, with correct CRS.




overlay_intersectsin the way you want. Your expression evaluates intersection (without buffer), then only for the results creates a buffer as output. For what you want to do, useoverlay_nearestwithmax_distance