[pgrouting-users] FW: Multiple queries in a row

Tao Romera Martinez taoromera at gmail.com
Wed Nov 21 03:05:08 PST 2012


Hi Iñigo,

I needed to do something similar to what you are trying to do some time ago
and asked in the list. Unfortunately, it is not possible to retrieve
several shortest paths in one run. It is certainly possible to reduce the
time needed to perform the shortest path routing between a set of nodes,
but for this the code of the shortest_path C function should be modified to
fetch the road network data it needs from the DB only once and then perform
the routing algorithm several times.

Tao


2012/11/21 Iñigo Vázquez <ivgwildchild666 at hotmail.com>

> Thanks for your reply, but in my case the shortest path doesn`t interest
> me. I need the shortest paths from one given node to each others beacuse
> then I want to calculate a path taking into account a given time limit.
>
> Something like in the "Traveling Salesman Problem" but with Time Window.
>
> Thanks!
>
> ------------------------------
> From: gunnar at tradlosetrondheim.no
> Date: Wed, 21 Nov 2012 11:08:03 +0100
> Subject: Re: [pgrouting-users] Multiple queries in a row
> To: pgrouting-users at lists.osgeo.org
> CC: ivgwildchild666 at hotmail.com
>
>
> Hello,
>
>
> I do not know the answer to you question, but I might know an workarround
> if you are only interrested in the shortest of them.
>
> We use a hack to find the path to the closest node of a set of nodes.
>
> Basically we tweak the query which builds the graph to rename all nodes
> which are applicable to some id which cannot be found in the graph elsewere
> (e.g. -1), and the search for the path to this node.
>
> (NB: this could/would give strange beahviour if used with astar)
>
>
>
> Best regards Gunnar
>
>
> 2012/11/21 Iñigo Vázquez <ivgwildchild666 at hotmail.com>
>
> Dear all,
>
> I need to obtain a set of nearest nodes from a given location (maybe 30 or
> 40). Then I need to calculate the shortest path from the given node from
> each others. It means to execute shortes_path query multiple times in a
> row, wich takes about 2 seconds (1 query 2 seconds: 30 queries 60 -> too
> long).
>
> SELECT * FROM shortest_path('
>    SELECT id AS id,
>           source::int4 AS source,
>           target::int4 AS target,
>           cost::float8 AS cost
>    FROM tt_2po_4pgr',275742,274494,
> false,
> false)
>
> What would be the best way to do this in a reasonable time?
>
>
> Thank in advance!
>
>
> Pd: excuse my english
>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>
>
>
>
> --
>  Gunnar Rangøy  System developer  Trådløse Trondheim / Wireless Trondheim
> tradlosetrondheim.no  +47 99 36 06 99
>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20121121/44b850b4/attachment.html>


More information about the Pgrouting-users mailing list