[postgis-users] Nearest Aid station to accident

Stephen Woodbridge woodbri at swoodbridge.com
Thu Apr 24 08:52:07 PDT 2008


Matthew,

In general it looks like if there are 10 aid stations in the 20km radius 
that you are computing 10 routes. This is fairly expensive time wise. 
I'm not familiar with PgRouting bout a better solution might be to 
compute a single Dijkstra solution the is limited to the 20km distance 
from the accident, and then you should be able to just check the time to 
each of the aid stations from that single solution. Bijkstra's solution 
computes the time to all nodes within the cutoff distance in the network 
which should be more efficient than some number of shooting star 
searches. I do not know where the trade off from Dijkstra to Shooting 
Star is and it is probably some combination of cutoff distance and 
number of possible aid stations in the area.

Hope this helps,
  -Stephen Woodbridge
   http://imaptools.com/

Matthew Pulis wrote:
> 
> 
> Hi,
> 
>  
> 
> I am trying to make a query where is given the nearest aid station 
> (hospital / fire station – either which passed through a parameter). 
> Nearest being on the road network itself, thus I am using pgRouting’s 
> function : Shooting_star.
> 
>  
> 
> My idea to tackle the problem is :
> 
> -          Make an expansion of the accident of 20 KM
> 
> -          Check which hospital / fire station is within that expansion
> 
> -          Find the shortest distance between every hospital / fire 
> station to the accident location
> 
> -          Prepare the route for the shortest distance
> 
>  
> 
> What I am finding hard to implement is the part where to find the 
> shortest distance on the road network.  It is taking more or a less a 
> minute there. Any idea how I can improve it please?
> 
>  
> 
> This is my code :  http://yancho.pastebin.com/f75683d8b - The section I 
> am worried about is : 72 – 96 (highlighted in yellow)
> 
>  
> 
> Any idea is extremely appreciated.
> 
>  
> 
> Regards
> 
>  
> 
> Matthew
> 
>  
> 
> I am using the free version of SPAMfighter for private users.
> It has removed 27617 spam emails to date.
> Paying users do not have this message in their emails.
> Try SPAMfighter <http://www.spamfighter.com/len> for free now!
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list