If you do a union without the optional layer
you get your polygons splitted on the overlap
Then you need to run the algoritm 'join attributes by location (summary)'
Choose '****equals' as predicate. Select one field (eg. id) as field to summarise. Check 'count' as summaries to calculate.
After running 'join attributes by location (summary)' you need to ...
It sounds like you want to take the difference between your two layers. You may need to run the operation twice (for A-B and B-A) then join the results if you intend to have all of the data in the same layer.
Thank you all for all the hints and advice.
So far I've ended up with filtering out
polygons smaller than 10sqft or 1sqm considering them as an error.
SELECT geom, ST_Area(geom) sqft FROM (
(ST_Dump(ST_Intersection(orig, diff))).geom as geom
, poly2 as orig, ST_Difference(poly1, poly2) as diff
To find polygons which "truly" intersect (ie. have some shared area in common) then ST_Relate must be used with an Intersection Matrix pattern of T********. There is no standard named predicate which provides this semantics. (It would be nice if there was a named predicate called something like "interiorIntersects".) The PostGIS doc has an example.
I think it is likely that the analysis of ST_Overlaps and ST_Touches for multi-part geometries may not be entirely correct in versions of PostGIS less than 3.0.0. Not that of ST_Intersects, a function that supports geometry collections since version 2.5.0.
The product of the intersection between two geometries can result in a GEOMETRYCOLLECTION even if ...
Uf you want to find overlaps of two polygons, then your best fried is st_intersection in conjunction with st_intersects (it's not the same function). You should firstly join polygons using st_intersects. Then get intersected geometries with st_intersection. This will produce different geometry collections based on type of interaction. Points and Lines in ...
when you intersect the newly created polygon receives information from both polygons. You can omit the results or the intersections you don't need by doing a simple selection in the attribute table.
In the example below the polygon highlighted is the one you are looking to single out.
notice how in the attribute table its the only feature from the ...
You can set each layer to render differently when there is an overlap with another layer. Go to the style, expand layer rendering, then select multiply under layer blending mode.
If you want to see overlaps with polygons from the same layer, you could (also) set the feature blending mode to multiply.
As another option, you may be able to add a layer dedicated to show the overlapping area, so that you can keep original three polygon layers, showing thin outlines only.
Run Build virtual vector tool (in QGIS Processing Toolbox > Vector general), with Create Unioned VRT option.
Put the newly created layer underneath and set color and transparency.
I use the 'Line Pattern Fill' with a different colour and line fill rotation for each layer.
It can be useful to create a variable in the project properties to use as the spacing between lines, fill line weight etc, this will make it easier to adjust all layers by changing one or two variables instead of lots of variables for different layers.
See below ...
To get that polygon I would first Union the purple and pink feature classes together.
Then I would use the Select tool to create a new feature class for any polygon with a pink ID >= 0 and a purple ID equal to that polygon at top left.
To deal with a more complex situation I think we would need to know more about your rules for which particular ...