7

enter image description here

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.

1

2 Answers 2

14

Another solution would be to use a Geometry Generator fill for that, together with the powerful aggregate function:

enter image description here

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.

1
  • This is awesome! Thank you @eurojam!
    – Dev
    Commented Sep 4 at 22:22
7

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.

layers used

In DB Manager, connect to your data file (in this case a GeoPackage) and create a query similar to this:

db manager

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:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.