I have a multipolygon layer with several regions (green circles) that are identified through numerical fids. Within each region are multiple points (orange dots) with individual pointIDs. See example for region 7 below:
Here is a visualization:
My problem is that the circles overlap so much that some might have the same set of pointIDs within them. Therefore, the goal is that for all two or more circles that cover the same points(/contain the same pointIDs) I only want one circle to remain while all others are deleted. Which circle stays doesn't matter. But it is important that the individual PointIDs for each circle that remains are preserved.
I have tried reaching that selection by using the "Select by expression" in QGIS but I am not familiar with the expressions and not sure how to fully implement my query.
I was thinking of something like this, but it is invalid and I doubt that array_distinct would actually find two "PointID-lists" identical if they have different fids:
array_agg( "PointID" , order by "PointID" , group by "fid"),
Does anyone know how to write an expression that selects all fids from the layer that have a distinct set of PointIDs?
As an alternative to "Select by expression", I think a virtual layer may be an option. I actually tried using a SQL query that I found online to create a virtual layer with the selection, but QGIS doesn't seem to recognize the array_agg function here:
array_agg(t.PointID ORDER BY t.PointID) PointIDs
FROM JoinedLayer t
GROUP BY fid
FROM JoinedLayer t1
INNER JOIN cte c1
ON c1.fid = t1.fid
WHERE EXISTS (SELECT *
FROM cte c2
WHERE c2.fid <> c1.fid
AND c2.PointIDs = c1.PointIDs);