2

I have a point layer with the "ID" field containing values from 1 to n, and some NULL values.

With the following expression, I manage to draw the concave_hull grouped by "ID" value:

concave_hull(collect(
             $geometry,
             group_by:=overlay_nearest(@layer,"ID",limit:=1))
             ,0.0)

Result:

enter image description here

I would like the NULL value to not create its own concave_hull. And instead of this, the points that have NULL value creates the concave_hull with the points of the nearest value. I try to explain what I am saying with an approximate representation of the expected result:

enter image description here

1 Answer 1

5

Use this expression:

concave_hull(
    collect(
        $geometry,
        group_by:=if (
            ID is NULL, 
            overlay_nearest (@layer, ID, filter:=ID is not NULL)[0],
            ID
        )
    )
    ,0
)

Points inside the blue circle have ID=NULL: 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.