[pgrouting-users] closest facility with pgrouting

Stephen Woodbridge woodbri at swoodbridge.com
Wed Jan 14 05:41:35 PST 2015


On 1/14/2015 5:36 AM, Peer Krueger wrote:
> Dear pgrouting-users,
>
> I am looking for users who already made some experience with
> closest-facility-functions in pgrouting.
> I want to use this funcionality but even if a function "drivingdistance"
> exists there does not seem to be a closest facility-function implemented
> yet.
> Perhaps kdykstra would be a starting-point to build such a function.
> Has anyone yet tried to implement this before or can give me some hints
> where to start?
> best whishes,
> Peer

Peer,

I would do something like:

select * from kdijkstraCost('select * from edges', source, targets[], 
directed, has_rcost) where cost>0 order by cost asc limit 1;

id1 - will be the start node
id2 - will be the destination node
cost - will be the cost from id1 to id2

Make source your current location, and targets[] is an array of 
facilities to consider.

-Steve


More information about the Pgrouting-users mailing list