[pgrouting-users] pgRouting dijkstra (points and lines)

Daniel Kastl daniel at georepublic.de
Wed Oct 12 11:02:43 EDT 2011


If all your data is in the database, then you can so queries within your
shortest path query.
Look at this workshop example:

SELECT * FROM shortest_path('
                SELECT gid as id,
                         source::integer,
                         target::integer,
                         length::double precision as cost
                        FROM ways',
                5700, 6733, false, false);
http://workshop.pgrouting.org/chapters/shortest_path.html#core

You can replace start and end point with a query, which is in my example
from the same table. But you can modify such a select however you like:

SELECT * FROM shortest_path('
                SELECT gid as id,
                         source::integer,
                         target::integer,
                         length::double precision as cost
                        FROM ways',
                (SELECT min(source)::int FROM ways), (SELECT
max(source)::int FROM ways), false, false);

Does this help?
Daniel

On Wed, Oct 12, 2011 at 4:21 PM, dy32 mutQ <dmutq at yahoo.com> wrote:

> hello all,
> I have a question, how can I get the shortest path with dijkstra algorithm
> on a map but additionally have another layer or points of interest files
> from the map.
> I set up pgrouting from
> http://www.utdallas.edu/~ama054000/rt_tutorial.html
>
> for example: I have two layers, hotel (points) and road (polylines)
> From hotel A (start point) to hotel B (end point) I can get road 2,3,4
>
> there is any way to integrate these two files (point and line) into one so
> that for the calculations. In other words, how can I connect two tables,
> road and hotel to get dijkstra result?
>
> Thanks for your answers
>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>
>


-- 
Georepublic UG & Georepublic Japan
eMail: daniel.kastl at georepublic.de
Web: http://georepublic.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20111013/e2781fb0/attachment.html


More information about the Pgrouting-users mailing list