4

I am trying to use the v.distance function from QGIS ToolBox to calculate the closest distance between points to areas. The problem is that even if I have added new columns ("dist", "attribute") to the from_point file (.csv), there are no options for me to choose them for the upload column (using the GRASS tool GUI; please see the screenshot below). The only options are the lat long columns, which obviously means my point coordinates get overwritten immediately and the processing runs into an infinite loop of errors...

I am now trying to look into running the grass function on Python Console, but it hasn't worked so far (no error message but no output either; the upload column is empty after running).

the options for column name to be chosen; even though I have more than these two columns in the imported vector layer attribute table

2
  • Did you try converting your CSV file to a geopackage or shapefile?
    – Babel
    Commented May 17, 2021 at 15:56
  • 1
    @Babel, yes I did. I found out it's more about the column data type which has to be numeric to be recognised somehow (even though if I want to store attributes that would be 'string'?). I also can't change the column type in qGIS, had to add a few numbers to the new columns in excel and import them again... If anyone has better solution please help ;(
    – Yuya Ra
    Commented May 19, 2021 at 10:18

1 Answer 1

1

Regarding your question in the comment: "If anyone has better solution please help ;( " I'd suggest to try to do this directly in GRASS, thus skipping the limitations of the QGIS plugin.

You would import your CSV to a GRASS Location (defined by the correct coordinate system with v.in.ascii. Then add a target column for the distance with v.db.addcolumn column="dist DOUBLE PRECISION", and then run v.distance.

The Processing Toolbox is great for "quick and dirty" running of GRASS, GDAL or SAGA modules. but whenever you need more control over the parameters, go back to the application itself.

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.