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?
-
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?– MarekCommented Jun 1, 2023 at 20:29
1 Answer
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')
)
)
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:
By the way: For larger datasets, you might consider an intermediate table, similar to this or this or this, like:
- Layer parcels (as you have now),
- Layer owner, containing just the persons,
- Layer connections, connecting owners to parcels.
-
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! :)– MarekCommented Jun 12, 2023 at 14:31
-