1

I am working on a project where I have one shapefile with regional districts of Germany, and another with many small biotope polygons which are overlapping with those regions. Meaning one region contains many of those biotopes. Added to these biotopes are many columns of data.

What I am trying to do, is to add data of exactly one biotope polygon to each polygon in the regions shape. Basically the data of the biotope polygon with the smallest value in column "x" should be added to the region shape file which contains the biotope.

I did find the join by location summary function, but of course then it only adds the smallest value of column "x" to the polygon, but not all the other values.

Since I am still quite new to QGIS I might be missing an obvious solution.

How do I add the data from one (of many) polygon to a second one containing the first, but only if the first polygon has the lowest value in column "X"?

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Nov 17, 2022 at 12:40
1
  • 2
    Please edit your question and try to summarize your issue in one sentence with a question mark at the end. That will improve the clarity of your question. Commented Nov 17, 2022 at 12:51

1 Answer 1

2

You can use a Field Calculator expression on your regions layer like so:

array_min(
 overlay_contains(
 'biotope layer', -- the name of the layer containing the biotope polygons
 "X" -- the name of the field from which to take the lowest value
 )
)

Result:

enter image description here

The large labels in the image below are the calculated values in the regions layer, the small labels represent the "X" values in the biotopes layer.

enter image description here

Note:

I use overlay_contains rather than overlay_intersects else the lower left 'region' would be assigned 8 also (its boundary intersects the boundary of the biotope feature in the upper left 'region'). Depending on your data, you may need a more complex predicate. Let me know if you experience problems and I will adjust my answer.

answered Nov 17, 2022 at 15:09

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.