I am trying to make a new attribute field which will differentiate points, vector layer, which lie inside and outside of a polygon layer.

I tried like this:

    WHEN 'points_67ebb752_4208_4b2b_9b1d_419efb341ff3' IN 'polygon_D_e5a424dd_6e6f_447e_952a_44b4f0dd6f9a' THEN 1
    ELSE 2

Would something like this possible at all in a way that a layer is used to differentiate on another layer, position vise, so that end result are two different values on an attribute field of the first layer.

  • IN is used to determine whether a value is within a list of values (which is shown in the example in the field calculator).
    – Erik
    Commented Jun 8, 2022 at 9:30

1 Answer 1


Try this:

if(overlay_within('polygon_D_e5a424dd_6e6f_447e_952a_44b4f0dd6f9a'), 1, 2)

It utilizes the overlay_within() and if() functions.

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.