1

Can we get the coordinate of nodes belongs to shortest path???

I give brief description, I calculate the shortest path with A* algorithm using Pgrouting, but what I'm looking for coordinates (long, Lat) of all the nodes that belong to path???

1

There are several examples how to join the result of a pgRouting query with its original table to return the geometry as part of the result, starting with the following example:

SELECT dijkstra.*, ways.name, ST_AsText(ways.the_geom)
FROM pgr_dijkstra(
    'SELECT gid AS id, * FROM vehicle_net',
    (SELECT id FROM ways_vertices_pgr WHERE osm_id = 61350413),
    (SELECT id FROM ways_vertices_pgr WHERE osm_id = 61479912)
    ) AS dijkstra
LEFT JOIN ways
ON (edge = gid) ORDER BY seq;

In the example above the geometry is returned in WKT format with ST_AsText(ways.the_geom) but you could also get single lat/lon points using ST_DumpPoints(ways.the_geom) instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.