TransWikia.com

visualising edge_graph from list pgr_dijkstra graph

Geographic Information Systems Asked by shitathakin on August 11, 2021

I am creating a query that finds the shortest path from dangerous crossing nodes to hospitals (many-to-many). I have the proper output from pgr_dijkstra, with output as follows


seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost 
-----+----------+-----------+---------+------+------+------+----------
   1 |        1 |         2 |       3 |    2 |    4 |    1 |        0
   2 |        2 |         2 |       3 |    5 |    8 |    1 |        1
   3 |        3 |         2 |       3 |    6 |    9 |    1 |        2
   4 |        4 |         2 |       3 |    9 |   16 |    1 |        3
   5 |        5 |         2 |       3 |    4 |    3 |    1 |        4
   6 |        6 |         2 |       3 |    3 |   -1 |    0 |        5
   7 |        1 |         2 |       5 |    2 |    4 |    1 |        0
   8 |        2 |         2 |       5 |    5 |   -1 |    0 |        1 

I am trying to use st_makeline to create seperate lines for each individual node path, however thus far the function has been creating one big line

SELECT  st_transform(st_makeline(t1.the_geom),4326)
        FROM pgr_dijkstra(
                'SELECT osm_id as id, source, target, cost FROM spatial.melbourne_edges',
                array(select hospital_id from hospitals_in_vicinity), 
                array(select crossing_id from dangerous_crossing_nodes), false) as route
                inner join spatial.melbourne_nodes t1 on route.node = t1.id --);

How am i able to make a column of all the different paths?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP