1

I'm using QGis 2.18.25 in Windows 10. I have a point vector with multiple points that represent a location in a certain date, so they have an integer field with the numbered order for each point as in the image. I would like to be able to get the distances between point 1 and point 2, point 2 and point 3, and so on. Using the measuring tool is not really an option since I have other hundreds of point vectors and it would take too long.

numbered points

I've tried using a distance matrix but the end results are way different than when I manually measured them, and the Points2One plugin only generates one single line that bends in each point while I need the distance of each segment between them.

Is there any other way to do this?

2 Answers 2

2

In the end I followed @StuSmith's suggestion and found a different solution.

Instead of using the hundreds of individual point vectors I used a vector I had with all the points with a category field (which I had used before to split the vector in the hundreds of individual vectors with Vector > Data Management Tools > Split Vector). With the Points to Paths tool (Toolbox) I grouped the points by category and ordered them with the numbered field. After that I used the Explode lines tool (Toolbox) to split each line by its vertex and created a new field with the $length formula to get the distance between points. The unit of these lengths is defined by the current project's properties, in my case, they were in meters. In the end, the attribute table looked like this:

attribute table

The first three distances rows are from group number 2 (which had 4 points) from point 1 to point 2, point 2 to 3 and point 3 to 4. The begin and end fields come from the Points to Paths process, which were splitted in 3 by the Explode lines process (that's why the values are the same for all the rows belonging to the same group).

1

Rocio, you say that the Distance Matrix tool gives different results than the measuring tool, but you don't say if either technique provides the correct answer.

At QGIS 3.8.3, the measure tool always gives me the correct distance (regardless if I choose meters, feet, yards...). The Distance Matrix tools also gives me the correct distance, BUT its results are always in meters, regardless of the layer or project CRS.

I reviewed the QGIS help pages (version 3.4) for the Distance Matrix tool, and they did not specify which output units the tool generated. Until your question, I would have assumed the same units as the Project Properties CRS, but after my review, it appears to be meters.

FYI, the version 2.X Points to Paths plugin tool (note the plural Paths) with the Line per Vertex option clicked on will generate separate lines between points. Try that instead of the Points2One plugin.

5
  • Forgot to add that the measuring tool was the one with the correct results. The Line per Vertex option doesn't appear for me in the Points to Paths plugin tool, but I managed to split the lines with the Explode lines tool in the end. Thanks to your comment I tried the Points to Paths plugin tool again and solve it, so thank you! Nov 4, 2019 at 4:56
  • What about the Distance Matrix results? Are they in meters?
    – Stu Smith
    Nov 4, 2019 at 5:04
  • @RocíoGuzmán If you found a solution, the best thanks you can give this community is to post the solution as an answer. That way everyone benefits from what you learned.
    – csk
    Nov 4, 2019 at 16:20
  • @StuSmith They seem to be in meters but some of the results seem way off. The few I checked were about 4 m off, which is a lot in the scale that I'm working. Nov 4, 2019 at 20:11
  • @csk Makes sense, I will do that. Nov 4, 2019 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.