1

I am trying to filter as part of an intersection but can't work out where to add the filter.

The intersection works fine intersects($geometry,aggregate('DSC_Roads','collect',$geometry))

But where can I add filter:="owner" in ('Private','Council') to only work on the 'DSC_Roads' layer when the owner column is in ('Private', 'Council')?

1 Answer 1

1

You're almoste there - add the filter as last argument of the aggregate() function. According to help for aggregate(), the syntax looks like:

aggregate(layer, aggregate, expression, [filter], [concatenator=’’], [order_by])

[] marks optional arguments

Thus the expression must look like:

intersects(
    $geometry,
    aggregate(
        'DSC_Roads',
        'collect',
        $geometry, 
        filter:="owner" in ('Private','Council')
    )
)

Only polygons with owner attribute value = 'Private' or 'Council' are selected: 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.