I have a set of points and I want to create lines from them. Points belonging to one line have unique UniqueID to be grouped by. I try to use QGIS' Points to path algorithm. What I don't have is an order field, so the problem is that it connects the points in random order.
The picture contains an example of a line with 6 points. The QGIS Points to path algorithm connects the points in the following order: 1,3,2,6,4,5 and creates visually a good looking line, but with the length longer than the line between point 1 and 6. So I would like to know how to establish the order for the points to be added when creating a line. The points need to be connected from beginning to end in order i.e. 1,2,3,4,5,6.
The attribute table is shown on the picture. Each point has unique fid and a field called UniqueID that groups the points to one line i.e. points that belong to the same line have the same UniqueID. The name of the attribute comes from the data I have received so can't really make it better.
How can I introduce an order so that I can have points connected by shortest path? The end goal is to calculate the length of lines, so if that could be done easily on the lines created from the unordered points, it is also a good solution to the issue.