I have two polygon layers:
A) Contains around 500 river catchment areas
B) Contains 100 river catchment areas
I want to create a new data field in Catchment A showing which catchment (Catchment B) the catchment (Catchment A) belongs to.
I could do this manually by "Selection by location", but since there are a lot of rows, it would be nice to do this in the Field Calculator.
QGIS-version is 3.24.3 and I use the following expression:
overlay_intersects('Catchment B',"id",sort_by_intersection_size:='des')[0]
As you can see on the screendump, catchment 200 (Layer B) overlaps with catchment 3110,7330, 7320 and 7310 from Layer A. I want "200" added to a new field in the table of these fore catchments.
array_to_string(overlay_intersects('Layer B', "id"),',')