I have a small road network which I have extracted from OSM and prepared for routing using OSM2PO. I also have a separate layer of points (postcode centroids). I wish to compute many-to-one routing between each point to a single destination.

In my research I have found many useful answers regarding how to undertake a many-to-one routing, but all these solutions require manually entering a source/target id for each origin edge. (The single destination is, of course, simple and I am happy to manually input that source/target id.)

Is there a way in which I could programatically find the nearest edge to each point and then pass the relevant source/target ID into the pgRouting algorithm, looping through for every point?

Here is a picture of my data in QGIS which may help clarify the situation:

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.