I have a point data with depth values in CSV format as well as a polygon layer with a 'Critical_Depth' attribute. I'm trying to use the label rule expression to change the colour of the text depending on whether the point 'Depth' value is above or below the 'Critical_Depth' for that area.

I can achieve this by saving the CSV as a geopackage and adding a field 'Critical_Depth' that is calculated using a spatial join, but i'm wondering if i can simplify the process.

Above - Depths CSV data

Above - Polygons with Critical_Depth value

Above - Raw xyz data

Above - What I'm trying to achieve

  • 1
    You could do some fiddling with aggregate in order to grab the values.
    – Erik
    Nov 18, 2020 at 13:10

1 Answer 1


I got it working with this - "Depth" > aggregate(layer:='DepthAreas',aggregate:='max',expression:="Critical_Depth",filter:=intersects( $geometry, geometry(@parent) ) )

Your Answer

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

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