I have several layers which overlap sometimes. I want the symbol visualized on top to be based on the smaller value between the three layers. How can I do that?
1 Answer
If you are ok with creating a new layer you can Union (multiple) with one layer as Input Layer and the other two as Overlay layers.
This will create one output layer with all geometries and attributes from the three layers.
I have field named value in each of the three layers. The output attribute table will have all fields. Since all my three fields are named value the output fields will be named value, value_2, value_3:
Style the output layer with the expression:
array_min(array(coalesce("value", 999),coalesce("value_2", 999),coalesce ("value_3", 999)))
, change the three field names to match yours, and 999 to be larger than any max value in the fields.
Where layers overlap, the min value will be used to style the geometry:
-
nice, i like this approach. Thanks!. Would it also work if I merge the layers (merge vector layers) instead of union? Commented May 24 at 12:36