In QGIS I would like to get the closest points to each building I have already selected. I have layer for points (low tension poles) as well as layer for buildings, I selected some buildings which are quite many and wish to get the closest point (pole) to each building I have selected.

Is there any plugin or faster process I can use to solve the issue?

  • 1
    Welcome to SE. I would suggest you have a look over the Tour - gis.stackexchange.com/tour - it provides some guidelines on how best to ask a question. Have you tried anything already in QGIS? What version of QGIS are you using? Feb 22, 2018 at 11:02
  • Yes I have tried some things in Qgis and am using version 2.18.16
    – IYKE
    Feb 22, 2018 at 11:59
  • This question here is similar: gis.stackexchange.com/questions/228544/… . What have you tried in QGIS. If you include it in the question it lets the people answering know, and they can try and help as best they can. Feb 22, 2018 at 12:01
  • I have done it through help of someones suggestion using NNJoin plugin
    – IYKE
    Feb 22, 2018 at 13:17
  • That is great. I see the answer below. Please mark the answer as correct by ticking the green tick in his answer. This will help other people with similar questions in future. Feb 22, 2018 at 13:19

3 Answers 3


You can use the NNJoin Plugin to do this job but just make sure that your join layer is a projected CRS.

  • it seems NNJoin works with line and point, but not polygon.
    – IYKE
    Feb 22, 2018 at 12:00
  • Yeah, I tried it and it helped to a reasonable extent. Thanks alot
    – IYKE
    Feb 22, 2018 at 12:11
  • NNJoin should also work with polygons. Aug 20, 2018 at 6:47

"Join attributes by nearest" will do what you want:

Takes an input vector layer and creates a new vector layer with additional fields in its attribute table. The output features will contain the selected attributes from the nearest feature, along with new attributes for the distance to the near feature, the index of the feature, and the coordinates of the closest point on the input feature (feature_x, feature_y) to the matched nearest feature, and the coordinates of the closet point on the matched feature (nearest_x, nearest_y).


Looking through the "Processing Toolbox" I see there is a Distance Tool called v.distance. It seems it will calculate the nearest elemanet in a vector map from a defined "From" to a defined "To" vector layer. Here is a snip from help file:

v.distance finds the nearest element in vector map (to) for elements in vector map (from). Various information about the vectors' relationships (distance, category, etc.) may be uploaded to the attribute table attached to the first vector map, or printed to 'stdout'. A new vector map may be created where lines connecting nearest points on features are written

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.