I am working on a map with buffer radii that overlap urban zones. How can I highlight just the area of overlap within the zone? I'm currently setting the buffer to the max-allowable height of buildings in a new scenario, and if that area overlaps with a zone that currently has a lower max-allowable height, I'd like for that area to be highlighted. Currently, the whole zone changes colour.
2 Answers
Another solution would be to use a Geometry Generator
fill for that, together with the powerful aggregate
function:
aggregate(layer:='Buffered',
aggregate:='collect',
expression:=intersection($geometry, geometry(@parent)),
filter:="hei">attribute(@parent, 'mah')
)
the above expression will collect all intersecting geometry parts of the buffered layer into a multipart geometry which is symbolized with line pattern fill where the height (field "hei"
) is higher than the max-allowable height (field "mah"
) in the zone layer.
I'm unsure if you could achieve what you need with ruled-based symbology. An alternative approach would be to use the DB Manager to create a query layer containing just the overlap areas. Here are the layers used to test this. The labels hold the value in field max_height.
In DB Manager, connect to your data file (in this case a GeoPackage) and create a query similar to this:
Here is the query text:
select
buffered.max_height as buf_max,
base_layer.max_height as base_max,
ST_Intersection(buffered.geom,base_layer.geom) as overlap_geom,
round(ST_area(ST_Intersection(buffered.geom,base_layer.geom))) as overlap_area
from
buffered,
base_layer
where ST_Intersects(buffered.geom,base_layer.geom)
and buffered.max_height > base_layer.max_height
Result: