2

I am new to QGIS. I am looking for any plugin or any manual method in QGIS for finding minimum distance (perpendicular distance) from a point which is part of one shapefile to nearest line among many lines which is part of another shapefile.

MMQGIS is not useful for this purpose.

  • 1
  • Thanks kazuhito for reply. I used the method suggested by you. I am getting minimum distance ( perpendicular distance) from points which are part of one shape file to nearest line among many lines which is part of another shape file. But there is one problem. I am not identifying from the attribute table that which lengh is belong to which point. In attribute table, there 32 lengh values for 32 points w.r.t nearest line. Is there any method to identify which length value is belong to which point. – Jitendra Feb 16 '17 at 10:32
  • With your suggestion, I am able to corelate particular length data with particular point. But I am also want to know that lengh data belong to which line. In lines shape file, I have two fields 1. ID 2. Time. – Jitendra Feb 16 '17 at 12:27
  • . It is not working for my case. When I am using v.net.connect command new shape file is created which is containing cat, ID , time field and I added length field using field calculator. ID & Time field for existing lines are same as line shape file. However new line created from point to nearest line has null value for ID & Time field. It has only cat & length value. When I am doing joints by location method between line shape file & network file , I am getting details of only about old lines of line shape file and not getting any about new line created between points and nearest line. – Jitendra Feb 17 '17 at 5:33
  • I am getting length (minimum distance) between points and nearest lines w.r.t to points, but not able to corelate particular lengh value with respective line. – Jitendra Feb 17 '17 at 5:43
4

Based on the information in your comments and duplicates here and here, I'd like to suggest the following. This has been done using the 'Processing Toolbox' in QGIS which allows you to use GRASS algorithms easily within QGIS -

Add two columns to the point layer, one for distance(distance) and the other for the Line ID(id_line). When using v.distance, you can specify multiple options in 'upload' by entering the values separated by commas. Try doing something like this -

enter image description here

The 'dist' will upload the minimum distance to the column 'distance' and 'to_attr' lets you specify a particular column name from your line layer to be uploaded to 'id_line'.

Running this would give you your desired output in the layer saved in Nearest, a copy of your point layer with the columns 'distance' and 'id_line' populated.

Your result would something like this -

enter image description here

Alternately, if your processing toolbox doesn't show 'v.distance' you can use the GRASS shell directly and execute the command for v.distance as follows -

v.distance from=<point layer> to=<line layer> upload=dist,to_attr to_column=<column containing id> column=distance,id_line

Refer the man page of v.distance or just type v.distance --help in the shell for more options.

  • Thanks for reply. v.distance commnd is not showing/opening in processing toolbox. Is there any settings required for same? – Jitendra Feb 21 '17 at 19:06
  • Can you share which version of QGIS you are using? – nash Feb 21 '17 at 19:09
  • You can check under the options of Processing whether the GRASS provider is activated or not. – nash Feb 21 '17 at 19:10
  • QGIS version 2.14 – Jitendra Feb 21 '17 at 19:18
  • Do you have access to other GRASS algorithms in Processing? It may be that your provider is not activated. Which version of GRASS is installed? – nash Feb 21 '17 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.