I have a layer with street segments that I would like to join with a building + population layer. Desired result: The segment contains population data. Nearest neighbor (NNjoin) finds the closest building and adds its population to the attribute table. Issue: there are buildings on both sides of the segment. Is there a way I can join attributes from several buildings (within a radius, for example) to the segment, adding their values together? I use QGIS and GRASS GIS. Any ideas?

enter image description here

  • Thank you! I tried with attributes by nearest, but that does not seem to solve the issue of adding the population data together and placing it on the line. I am trying to go the other way now. I have given each building the same id as the nearest segment. Now I need to find a clever way to add the values for each id and join it back to the segment.
    – user181408
    Commented Apr 8, 2021 at 13:48

1 Answer 1


enter image description hereI found one solution:

  1. Join nearest neighbor, but segment to building (each building looking for the closest segment).
  2. Use Group Stats Plugin to sum the population for each join_id.
  3. Export the result as cvs
  4. Import into QGIS as delimited text layer (as attribute table)
  5. Join the values to the segments.

Your Answer

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