Finding distance between buildings and nearest road using QGIS?

While in general this would be better handled in PostGIS, there are plug-ins which do the heavy lifting for you:

  • NNJoin
  • MMQGis Hub Distance.

NNJoin

This is the preferable and correct way, however could be slow on large datasets. It has the non trivial advantage to compute the correct polygon-to-line distance, without converting buildings into points first (which could lead to erroneous results).

Hub Distance

Faster, but only works with point vector layers.

Since you are working with a local, projected system, make sure to check the Layer Units option.

An output layer will be created, with lines connecting each building with the closest road. Alternatively you can choose to have a point layer as output (one point per building)


For qgis 3.8 and later you can use "join by nearest" from the processing toolbox.