qgis – How to Use v.net.distance (GRASS) in QGIS

grassNetworkqgis

I'm trying to compute the shortest distance via the network between the given sets of features (schools to hospitals or cholera cases to pumps, for example), using the v.net.distance GRASS algorithm inside of QGIS (Toolbox).
But there are several parameters in Advanced Parameters that have no instructions to use them. Where can I found instructions to use this tool?
The informations in https://grass.osgeo.org/grass72/manuals/v.net.distance.html does not have direct relationship to the Advanced Parameters.
enter image description here

My conclusions after reading Joseph's comments and Steven's answer.

A) From Category values: enter the id number of each desired feature for the analyzes. It is used instead of selecting the features with the mouse on the screen.

B) From WHERE conditions of SQL statement: it works when the "From Category values" field is filled or not.

C) To Category values: enter the id number of each desired feature for the analyzes. It is used instead of selecting the features with the mouse on the screen.

D) To WHERE conditions of SQL statement: it works when the "To Category values" field is filled or not.

E) Arc forward / both directions cost column: the length of the arc, for example.

F) Arc backward direction cost column: the length of the arc, for example. The length of the arc should be replaced by -1 when the direction is unique.

G) Node cost column: this is a numeric column of the From_points attribute table. I did not understand the effect of this parameter in the calculations.

H) The CAT column does not appear in the attribute table of the Network_Distance layer.

Best Answer

if you look at the help tab on the processing window, you should (hopefully) see a small web page with help for the algorithm (it'll just take you to the page you linked to in your question, but can save you a trip over to a browser window)

I seem to have a slightly different layout to you, you may have a slightly different version of QGIS and/or Grass to me. I see the following summary:-

v.net.distance [-gl] input=name output=name [arc_layer=string] [arc_type=string[,string,...]] [node_layer=string] [from_layer=string] [from_cats=range] [from_where=sql_query] [to_layer=string] [to_type=string[,string,...]] [to_cats=range] [to_where=sql_query] [arc_column=name] [arc_backward_column=name] [node_column=name] [--overwrite] [--help] [--verbose] [--quiet] [--ui] 

things in square brackets are optional. Ellipsis (...) means things can be repeated


Description files

Somewhere on your system there is a text file which QGIS uses to set up the processing dialog. It'll be called v.net.distance.txt.

If you can't find it in your file system, the Grass 7 description files are here on Github. But those may be more up-to-date than what you have installed.

I don't recommend editing this, but it shows the types, defaults and options for each parameter. (For me, on ubuntu, I'd need to be administrator to edit the file, but not to read it).

In my system this looks like this:-

v.net.distance
Computes shortest distance via the network between the given sets of features.
Vector (v.*)
ParameterVector|input|Input vector line layer (network)|1|False
ParameterVector|from_points|Input vector point layer (from)|0|False
ParameterVector|to_points|Input vector point layer (to)|0|False
ParameterNumber|threshold|Threshold for connecting centers to the network (in map unit)|0.0|None|50.0|False
*ParameterSelection|arc_type|Arc type|line;boundary;line,boundary|2
*ParameterString|from_cats|From Category values||False|True
*ParameterString|from_where|From WHERE conditions of SQL statement without 'where' keyword||True|True
*ParameterSelection|to_type|To feature type|point;line;boundary|0
*ParameterString|to_cats|To Category values||False|True
*ParameterString|to_where|To WHERE conditions of SQL statement without 'where' keyword||True|True
*ParameterTableField|arc_column|Arc forward/both direction(s) cost column (number)|input|0|True
*ParameterTableField|arc_backward_column|Arc backward direction cost column (number)|input|0|True
*ParameterTableField|node_column|Node cost column (number)|from_points|0|True
*ParameterBoolean|-g|Use geodesic calculation for longitude-latitude locations|False|True
OutputVector|output|Network_Distance

The ones starting with "*" go into the advanced section, as far as I can see. The bit between the first and second pipe characters is the name of the GRASS parameter, which you can look up in the help. The bit in the next field is the label which appears in the dialog.

This trick can be useful if you find the label ambiguous or unclear.

As Joseph says, some of these are actually routed to v.in.ogr (or v.out.ogr) instead, but these are clearly labelled.

Related Question