Bug report #5954

v.distance does not list existing columns, possibly broken?

Added by Paolo Cavallini over 12 years ago. Updated over 9 years ago.

Status:Closed
Priority:Normal
Assignee:Victor Olaya
Category:Processing/GRASS
Affected QGIS version:2.4.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:wontfix
Crashes QGIS or corrupts data:No Copied to github as #:15377

Description

The module tries to write the results to a column, but it does not automatically add it, and the text box does not list existing columns.
In any case, the result is empty.

History

#1 Updated by Paolo Cavallini over 12 years ago

The description (taken from GRASS) is unclear; please check the GRASS plugin for more clear descriptions

#2 Updated by Paolo Cavallini over 12 years ago

The optional output=name parameter to produce a vector of lines of minimum distance should be added

#3 Updated by Victor Olaya over 12 years ago

  • Status changed from Open to Resolved

fixed in r309. I have splitted the algorithm, since one of the params only applies when using the to_attr option

#4 Updated by Paolo Cavallini over 12 years ago

v.distance.toattr is not available from the list of modules

#5 Updated by Paolo Cavallini over 12 years ago

v.distance still does not work for me

#6 Updated by Victor Olaya over 12 years ago

  • Status changed from Resolved to Feedback

it works here (the algorithm executes), although the results are empty... One of the things this algorithm does is to update the input layer. That has no effect in SEXTANTE, since it is updating the layer imported in the mapset, not the orginal, so currently the algorithm does nt make much sense. Maybe it should be removed temporarily.

#7 Updated by Markus Neteler over 11 years ago

Perhaps 6.4.3 will address that: http://trac.osgeo.org/grass/log/grass/branches/releasebranch_6_4/vector/v.distance

It would be ideal to make a test with a current GRASS 6.4.svn snapshot.

#8 Updated by Giovanni Manghi almost 11 years ago

Markus Neteler - wrote:

Perhaps 6.4.3 will address that: http://trac.osgeo.org/grass/log/grass/branches/releasebranch_6_4/vector/v.distance

It would be ideal to make a test with a current GRASS 6.4.svn snapshot.

hi Marcus, were you referring to the "-a" parameter?

#9 Updated by Giovanni Manghi almost 11 years ago

Victor Olaya wrote:

it works here (the algorithm executes), although the results are empty... One of the things this algorithm does is to update the input layer. That has no effect in SEXTANTE, since it is updating the layer imported in the mapset, not the orginal, so currently the algorithm does nt make much sense. Maybe it should be removed temporarily.

see may notes here

https://github.com/qgis/QGIS/pull/989#issuecomment-28645026

in GrassAlgorythm.py should be possible to add a special case for v.out.ogr when v.distance is run, and make it use as input not the layer created as "output" by v.distance, but instead one of the inputs ("from"), that after v.distance is run is now modified and contains the min distances. I wasn't able to create a clean patch, but this approach definitely works.

In v.distance.txt we should just describe better the "output" because otherwise it can confuse users, something like this:

OutputVector|output|Output layer ("from" layer with updated column)

Adding the dmin/dmax parameters do also work

ParameterNumber|dmin|Minimum distance or -1 for no limit|None|None|-1
ParameterNumber|dmax|Maximum distance or -1 for no limit|None|None|-1

On the other hand it is not clear to me why the line vector representing min distances comes out empty.

I would suggest also remove the "-a" parameter (Calculate distances to all features within the threshold), from v.distance.txt and v.distance.toattr.txt and eventually making a separate module:

*) when using the "-a" parameter the "from" vector is not updated

*) when using "-a" it should be possible to output the results into a table (dbf), problem is that seems GRASS can only output this file inside de mapset folder (any attempt to use a path fails), so the results can only be seen in the processing log. And also it can be take a long time to run when features in from/to are relatively many.

#10 Updated by Giovanni Manghi almost 11 years ago

I would suggest also remove the "-a" parameter (Calculate distances to all features within the threshold), from v.distance.txt and v.distance.toattr.txt and eventually making a separate module:

probably this is not necessary as the distances are calculated referring to grass features "cats" and we know that anyway we remove this column when vectors are outputted, so this distances are not very re-usable.

85|9893|737.194183
85|9894|26.852766
86|7353|991.986074
86|7870|571.476415
86|9204|548.994394

#11 Updated by Giovanni Manghi about 10 years ago

  • Affected QGIS version set to 2.4.0
  • Project changed from 78 to QGIS Application
  • Category deleted (59)
  • Crashes QGIS or corrupts data set to No

#12 Updated by Giovanni Manghi about 10 years ago

  • Category set to Processing/GRASS

#13 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Feedback to Closed
  • Resolution set to wontfix

v.distance has been removed because it can't be used in Processing, unless it will be added as a special case (it updates an existing column of a GRASS vector instead of generating a new output). See https://github.com/qgis/QGIS/pull/989

#14 Updated by Paolo Cavallini over 9 years ago

  • Status changed from Closed to Feedback

I think this can be solved, so better keep it open not to forget about it.

#15 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Feedback to Closed

Paolo Cavallini wrote:

I think this can be solved, so better keep it open not to forget about it.

replaced by #12817

Also available in: Atom PDF