QGIS – Min & Max Buffer to Cover Features in Another Layer

bufferqgisvector

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?

Example

Best Answer

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").

Related Question