[pgrouting-users] Multiple queries in a row

Gunnar Rangøy gunnar at tradlosetrondheim.no
Wed Nov 21 02:08:03 PST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20121121/f4fca323/attachment.html>

More information about the Pgrouting-users mailing list