2

In QGIS I've successfully joined three tables of data: 'Addresses', 'Persons', and 'Polygons'. The polygons represent the address on the map, and each address "contains" the names of all people on that address:

enter image description here

I want to use Display/Map tips to show a list of all people on every address when hovering over the polygon corresponding to the address. I've done this by pasting [% "Person_Name” %] in the Display tab of the properties.

However, I cannot figure out how to print a full list of names. Only the first name on the list appears:

enter image description here

Is there a solution to print a full list of names when hovering over the address/polygon?

1

1 Answer 1

4

Can using "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer... to join the tables be an option?

For each address, a list of the names is created. The map tip is then displayed when hovering over the virtual layer.

select  p.adress, 
        p.geometry, 
        group_concat(a.name) as residents from Polygons p
left join adress a
on p.adress = a.adress
group by p.adress

enter image description here

.

enter image description here . enter image description here

2
  • 1
    BERA, Thank you so, so much! It worked perfectly, and I think that I understand what I did, haha. What I can't figure out (since I know no SQL yet) though, is how to add other information about the people. Let's say that I want to add Erik's gender or age or something. I've tried for a few hours now, but I'm really not getting anywhere. Thanks again!
    – Raspen
    Nov 5, 2022 at 14:19
  • 2
    Nice! stackoverflow.com/help/someone-answers You mean in the map tip you want to show name (from one column) and age (from another)?
    – BERA
    Nov 5, 2022 at 14:25

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.