This question already has an answer here:

I want to calculate minimum distance between points and a line in QGIS. I use "Distance Matrix", point shapefile contains 1337 points data, and I made unique ID as sequence number. A line is actually coast line and I convert text file to vector, then extract nodes using "Extract Nodes".

I followed manual and tutorial, but the output is different with what I expected. They mentioned that if I want to calculate minimum distance note check k=1, but I think my result contains the farthest distance. The output file's target ID is all the same. And I wonder what is the exact meaning of unique ID?

Please check and advise about my actions.

marked as duplicate by underdark qgis May 20 '17 at 7:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from stackoverflow.com Aug 18 '15 at 10:09

This question came from our site for professional and enthusiast programmers.

  • 2
    I think your approach is correct. Have you made sure both your point layers have the same CRS? And both layers will need a unique value field, so you can tell which is the closest point to each of your 1337 points.. you can add a unique id to your 'extract nodes' layer using the field calculator and $rownum – Steven Kay Aug 18 '15 at 11:22
  • You could also try v.distance in GRASS grass.osgeo.org/grass64/manuals/v.distance.html – MikeRSpencer Aug 18 '15 at 11:26