4

In a single layer, I want to use the feature with the value '33500' in the field "Seeding_Ra" to override the value of any feature that overlaps it, to that value, but just within the overlaping geometry.

Is there a way in the vector tools to do this?

enter image description here

0

2 Answers 2

5

You can use select by expression to select features on the same layer using the expression get_feature. The expression in this case is (see screenshot where the labels show the valule of the Seeding_Ra attribute for each polygon):

overlaps( 
    geometry (
        get_feature (
            @layer,
            'Seeding_Ra',
            33500 
        )
    ), 
    $geometry
)

enter image description here

You can thus use the following expression to update your attribute field Seeding_Ra (see result in the following screenshot, where the value of the Seeding_Ra has been updated to 33500 for polygons that overlap and has remained the same for all others):

if (
    overlaps( 
        geometry (
            get_feature (
                @layer,
                'Seeding_Ra',
                33500 
            )
        ), 
        $geometry
    ),
    33500,
     "Seeding_Ra" 
)

enter image description here

1

You can use 'Select by location', but your overlapping polygon needs to be a separate layer. Then you can select that layer and your original one and choose 'Overlap' or 'Intersect' as the geometry predicate, depending on what you need. Running the function will result in a selection of all the overlapped polygons.

Then you can use Field calculator and set it to update only the selected features. Choose the field you want to update and enter the value.

1
  • A good idea, but how can you perform this "but your overlapping polygon needs to be a separate layer.", otherwise avoid the creation of additional layers?
    – Taras
    Dec 9, 2020 at 13:13

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.