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"?

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.
    – saQuist
    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.

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.