1

I have a shapefile containing parcels borders (polygons) and a csv table with owner information. I can relate these (1:n) by the parcelnumber. So by identification I can see by clicking on the geometry if there are one or more then one owners of the property. By how can I query all the possible owners by selecting some relevant parcels? and how can I display all possible owners, if there are more than one?

enter image description here

1
  • Maybe the question is not precise: 1. How can I select all owners in the owner table, by clicking on the polygon (especially, when there is more than one owner? 2. Is there a way to lable the areas with all the owner information, like having both names on parcel 1 displayed?
    – Marek
    Commented Jun 1, 2023 at 20:29

1 Answer 1

1
+50

Using aggregate() function, you can relate to another layer and bring together (aggregate) all attribute values and filter them by a condition. So the expression to use on the parcel layer to achieve what you want is:

array_to_string (
    aggregate( 
        'owner', 
        'array_agg', 
        name,
        filter:= parcelnr=attribute (@parent,'parcelnr')
    )
)

enter image description here

If you have overlapping features, like a garage on two or more parcels (your comment), this does not affect the solution, you don't have to change anything, just be sure to make the correct connections in the non spatial table (here: layer owner), see:

enter image description here

By the way: For larger datasets, you might consider an intermediate table, similar to this or this or this, like:

  1. Layer parcels (as you have now),
  2. Layer owner, containing just the persons,
  3. Layer connections, connecting owners to parcels.
2
  • if there was a garage planned (Polygon on separate layer) on two parcels (imgur.com/a/OEly3vp), what would be the best way to evaluate all the affected owners? Babel, you are my hero! :)
    – Marek
    Commented Jun 12, 2023 at 14:31
  • You're welcome. See updated answer for that.
    – Babel
    Commented Jun 13, 2023 at 8:06

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.