I'm working with buildings in QGIS (vector polygons) and have two layers - call them a "source" building and multiple "sink" buildings (in second layer). How would I go about finding the minimum and maximum buffer from the "source" building required to "cover" the sink "buildings"?

Put in another way if I keep extending the buffer outwards of the "source" building, how can I get the difference between where this buffer first intersects a "sink" building and last intersects it?


  • 2
    There's always one source and on sink in each location? Do they share some common attribute?
    – Bera
    Commented May 9, 2022 at 9:48
  • 2
    Convert each "sink" polygons in points (vertex to points) and do a distance matrix between the source polygon and the points. You'll have to extract for each "sink" polygon identifier the minimum distance and the maximum distance. Commented May 9, 2022 at 9:56

1 Answer 1


Step 1: Make sure your sinks have a unique ID.

Step 2: Use extract vertices on your "sink" features.

Step 3: Run join attributes by nearest with your source features as first input and the extracted vertices as second input. Be sure to change the number of nearest neighbours so it meets or exceeds you maximum number of vertices on your "sink" features. The tool adds the direction and distance to the vertices to the attribute table of the source features.

Step 4: In order to get the minimum distance to the next sink for each source, run minimum("distance",group_by:="Unique ID of the sinks") - insert the unique ID attribute name accordingly.

Step 5: In order to get the maximum distance, run maximum("distance",group_by:="Unique ID of the sink").

  • 2
    Note that, while the maximum distance must be on a vertex, minimum can be on the edges.
    – geozelot
    Commented May 9, 2022 at 10:50
  • True. I guess then we'd have to run step 3 on both sink features and vertices.
    – Erik
    Commented May 9, 2022 at 11:14

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.