I have a Lakes layers which has a transparent fill, and a Rivers layer which (for the sake of its geometric network) flows "through" the Lakes layer. Like so:
I would like to use the Lakes as a symbology mask to mask out the Rivers so it looks like this:
I know for point layers you can set the symbology to mask use use that to mask out other layers, but is there a way to do that with polygon symbology? Ideally I could add another symbology layer to the Lakes layers and use that to mask out the Rivers.
I know I could do this by using a Difference function but I want to learn how to use polygons as masks because I could use that a lot elsewhere also.
I also tried using a virtual layer with an st_difference function but my knowledge of PostGIS is terrible so I didn't get far.
I also tried using a point pattern fill with large points set to mask but when I tried to use it as a mask in the Rivers layer it didn't work.
EDIT: Expanding on @Babel's idea, I could also set the River symbology to geometry generator using this expression:
difference($geometry, aggregate('Lakes', 'collect', $geometry)) However I would really like to know specifically if there's a way of using polygons as masks.