[pgrouting-users] Distance matrix using road network

Stephen Woodbridge woodbri at swoodbridge.com
Wed Jul 24 11:43:05 PDT 2013


On 7/24/2013 2:19 PM, Laura Kauria wrote:
> Hi all,
>
> I'm new with pgrouting/postgresql and I would need some detailed
> instructions making distance matrix using road network. Can you lead me
> to a good source or give some instructions here to get started?
>
> Thanks in advance! I have mac and I'd like to use pgrouting via QGIS or
> grass.

Hi Laura,

I will outline the process below, but you should read the docs for the 
details on how to do the steps:

Say you have ten locations the you want to build a distance matrix for:

1. map you locations to the nearest edge nearest end node
2. for each node call pgr_kdijkstra() with the node as source and the 
remainder of nodes as targets.
3. place the values in real8[][] array
4. adjust the array to be symmetric ie: a[i,j] == a[j,i] (we only 
support symmetric TSP
5. call pgr_tsp(a, start_id [, end_id])

I have no idea how you would do this from QGIS or grass.

Hope this helps,
   -Steve


More information about the Pgrouting-users mailing list