I'm new to pgrouting and normally use ArcMap to conduct any sort of network analysis. I have created a simple shortest path network along a downloaded OS Mastermap road network using pgRouting. However, I am unsure of how to develop an applied Origin-Destination route using point data (i.e. weighted population, libraries, public transport points etc..).

Do I need to join the point data with the road network layer to create a single network? I understand that the create topology function assigns nodes along the road network which are used as Source and Target points, but this will be a large scale project and can't afford to write out the lat long for each point along the road network.

I have also tried to use something like this below using the Foss4G format, however it didn't work. This created a random line along the road network rather between two 'Areas of Interest'.

INTO School_to_School
FROM pgr_dijkstra(
    'SELECT gid as id, source, target, length:: double precision AS cost
        FROM bristol_roads',    
    (SELECT id FROM bristol_education WHERE ref_no = 115422069),
    (SELECT id FROM bristol_education WHERE ref_no = 110687656), false) as dr
    JOIN bristol_roads
    ON dr.edge = bristol_roads.gid;
  • We do a lot of school/student-based routing using pgRouting as well as OSRM... could you elaborate as to what your end goal is for the project? Feb 24, 2021 at 16:42
  • This is work towards my PhD project. For part of my project I need to replicate daily motorised routes, i.e. travelling from residential address to various destinations. I normally would use Arcmap changing the inputs and cost surface layer, but processing time is long at city level and I need to create this for a national/LSOA level. Feb 24, 2021 at 16:46
  • So what I would potentially like is to develop least cost routes between all residential addresses to all potential destinations Feb 24, 2021 at 16:48
  • Most likely issue is that the id from your education layer is different from the node id in the road layer so it starts and finishes from a "random" point. You need to "snap" to the nearest road node for the eductaion points
    – Ian Turton
    Feb 24, 2021 at 17:10
  • @KathrynAdams this is something we do for bus routing analysis using OSRM where we create a distance matrix from each stop to every other stop... very fast using OSRM Feb 24, 2021 at 17:33


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.