2

In QGIS 3.34.4 I have 2 layers, one underlying layer (Layer 1) and an overlapping layer (Layer 2).

Both layers are polygon layers. I want to get the specific data of one field from layer 1 to a field in layer 2. Many polygons from layer 2 are overlapping multiple objects from layer 1. I want this done automatically via the attribute form.

I know that

array_to_string(overlay_within( 'layer 1', "field" )) 

can get me the results when the polygon of layer 2 only overlaps with a single polygon of layer 1, but whenever the polygon overlaps with multiple objects from layer 1 there is no result. This should be preferably displayed as follows: " value1 , value 2 , value3 ..." Some polygons have the same value, is it at all possible to show each value only once?

If it helps to understand: I want to display all the plot owners of the property underneath the planned project.

I am new to GIS and my QGIS is in another language.

asked Oct 18, 2024 at 6:48

1 Answer 1

2

You are using overlay_within so it will return something only for polygons from layer 2 that are totally included in at least one polygon from layer 1. To be within several polygons from layer 1 means that those layer 1 polygons overlap themselves, if that is not the case, getting no result is the expected result with your expression.

To get a result for polygons from layer 2 that overlap several polygons from layer 1 you should use the overlay_intersect function:

array_to_string(overlay_intersect( 'layer 1', "field" ))

To remove duplicate values from the result you may add an array_distinct function to your expression :

array_to_string(array_distinct(overlay_intersect( 'layer 1', "field" )))

You may also want to order the result with the array_sort function:

array_to_string(array_sort(array_distinct(overlay_intersect( 'layer 1', "field" ))))
Trikelians
6247 silver badges25 bronze badges
answered Oct 18, 2024 at 10:07

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.