Computing routes with common ID


I’m trying to compute the routes between two layers of points. Initially, I had two layers of points that did not have the same number of points (some departure points have several destinations). I was hoping that using a unique ID would allow them to join the departure and arrival points, but I was not successful.

So I subsequently duplicated the departure points so that I had as many departure points as arrival points. I ordered the two layers in the same order (departure points and arrival points) and I computed routes using the layer mode “Row-by-row”. However, as can be seen in the following screenshot, the FROM_ID and TO_ID fields are different, what it means that the routes obtained join the points in a way that I don’t understand. I don’t understand in which order he considers the rows to perform the “Row-by-row” calculation. Does someone have any idea how I could have at the exit, point A, ID XXX1 connected to point B, ID XXX1 and so on ?

Thanks for your help


It takes the order of the FIDs. Arguably not the most robust approach as the exact internal implementation of FID depends on the data source driver (shapefile different than PG table or GPKG), however, to be flexible and not require an actual numerical ID field, I can’t see many more options. And so far it worked fine when I tested.

There is a trick how to re-order features, but I can’t remember, too long I’ve actually been working with a GIS.

You can also (somehow) put each pair in the right order in one MultiPoint feature and use the MultiPoint layer in Directions from 1 Layer processing algo. It will then calculate the route within every MultiPoint feature.

Hi Nils,

Thank you for your quick answer!
I don’t know how to re-order features but I will try to find by that way. The other option seems to long in my case.