In QGIS 3.22 I am trying to visually represent a difference between polygons after its change. In the end I want to know where the polygon was enlarged (#72ff85) and where it was degraded (#ff7272).
To download data for testing purposes: https://we.tl/t-fqlOCAjLx5 (valid until 16.06.2022)
Let's assume there is a polygon layer called 'master', see the image below.
Later on the 'master' layer was saved as 'branch' and manually edited, see the image below.
Hereupon I want to visualize the difference between these two polygon layers. For that purpose I duplicated the 'branch' layer and applied the following graphical settings:
sym_difference(
$geometry,
geometry(get_feature('master','id',"id"))
)
if(
intersects(
$geometry,
geometry(get_feature('master','id',"id"))
),
'#ff7272',
'#72ff85'
)
However, I ended up with nothing meaningful. Seems like the output of the Geometry Generator is a MultiPolygon for which the expression does not work.
How can I achieve my visual aim just with Symbology from the Layer Properties menu?
I could get the desired result after using several geoalgorithms one after another, namely the "Symmetrical difference" and then the "Multipart to singleparts". And also applying some settings for the colour:
So, the reddish colour means that the polygon was degraded, and greenish colour means that it was enlarged.