4

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.

2
  • 2
    I think those advanced parameters are used to import the input vector data into a GRASS vector map using the v.in.ogr tool. This tool includes the advanced parameters you see in the interface.
    – Joseph
    Commented Apr 28, 2017 at 12:39
  • 1
    Regarding conclusion H), is there any way to do make the CAT column appear in the output? The analysis is rendered useless otherwise, since you cannot relate each output line to each "from" point feature. I'm only getting the 'tcat' and 'dist' columns when running this tool in QGIS, but in GRASS it the CAT column does show
    – 15Step
    Commented Dec 13, 2017 at 10:57

2 Answers 2

1

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.

1

Regarding H, a workaround is to intersect the Network_Distance layer with your 'from' and 'target' layers. The new layer allows to relate the distance measures to the statistics.

In my case, I first dissolve the Network_distance, using 'cat' and 'tcat' as dissolve fields. This leaves me with with one direct network line from each 'from' point to each closest 'target'. Then I intersect and proceed.

I admit, it is not elegant but allows to extract results.

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.