2

I have 2 shapefiles. One is a route and another one are the points along this route. I need to get the distance along the route. When I try to execute GRASS v.distance algorithm I get these errors:

WARNING: Concurrent mapset locking is not supported on Windows

ERROR: Unable to open file 'C:/Users/Пользователь/AppData/Local/Temp/processing_UCTeOT/d5f8dd391daf4b1ba9499140012d4380/crs.prj' for reading

ERROR: OGR layer <Ruby> not found

ERROR: Unable to open vector map <vector_61ac84296e5103>

ERROR: Vector map <output85a6234dfd7d40cba1621e564634d1ba> not found

ERROR: Key column <> not found

Loading resulting layers
The following layers were not correctly generated.
• C:/Users/Пользователь/AppData/Local/Temp/processing_UCTeOT/12f187556e0141bbbb0845767051974b/output.gpkg
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.

Could anyone suggest what does it want? QGIS version 3.16.14-Hannover

3
  • Not a solution, but I'd like to clarify that v.distance does not solve the problem of distances along a line. It adds to each of the points a distance to the line. I think you should be looking for Linear Referencing.
    – Micha
    Commented Dec 6, 2021 at 7:41
  • Are you sure? V.distance has several options including distance along. I watched this and it looks like its what I need youtube.com/watch?v=QzCrUll0gCI&t=305s Commented Dec 6, 2021 at 9:28
  • You are right! Sorry for misleading. The to_along option will add values to the points layer indicating the distance along the line for the connector from each point to the line
    – Micha
    Commented Dec 6, 2021 at 11:15

3 Answers 3

1

To test, I grabbed a line segment from a streams network, then digitized a few points near the line. Here's what I got running:

v.distance from=pts to=a_line output=connectors upload=to_along column=to_along

V.distance using to_along

Then, zooming in, you can see the connector lines from each point to the line:

Zoom in

HTH, micha

11
  • Thanks! Thats what I am looking for. Just don't understand the reason for errors I have Commented Dec 6, 2021 at 12:00
  • Can you be more specific as to what commands you are running, what your input layers are, and what error you're getting? What is "Ruby" in the error message above?
    – Micha
    Commented Dec 6, 2021 at 19:32
  • So the input layers are: 1. Shapefile with route, which is called "Ruby" 2. Shpfile with boulders(points) along this route. Points have attrubutes: name, easting, northing, KP. KP column is empty - there I want to have distance along . So I launch Grass v.distance tool, choose "from vector map" my boulders, "to vector map" - my route. Parameters I set to_along. Column name where values will be uploaded I set as KP. And then I press run and have those errors and new empty file which is called "nearest" Commented Dec 7, 2021 at 7:58
  • Can you load both shapefiles into QGIS? Do you know what coordinate projections they are in? (Maybe you already know, but you must have all components of the shapefile: *.shp, *.shx, *.dbf and *.prj for both the route and the points)
    – Micha
    Commented Dec 7, 2021 at 19:41
  • They both in the project. Projection EPSG 25831. Commented Dec 8, 2021 at 7:59
0

The path

C:/Users/Пользователь/...

looks potentially problematic. Can you try with a user account that does not contain any special characters?

1
  • Just tried, the 1st error gone. The rest errors still there: Commented Dec 5, 2021 at 13:07
0

The KP Find plugin does exactly this, it can do geodetic or Cartesian distances, as well. It can be found in the repository; the caveat is that it only works with projected coordinate systems.

2
  • Hello, thanks for comment! Kp find is good, but i can't use the result of the plug-in in graphical modeler for further calculations, can I? Anyway , solved the problem by implementing linelocatepoint function in my script Commented Apr 23, 2022 at 13:01
  • No, that is not currently possible. But this is good feedback, maybe in the future the option can be added.
    – miln40
    Commented Apr 24, 2022 at 14:48

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.