[pgrouting-dev] shortest_path using nodes instead of ways

cathal coffey coffey.cathal at gmail.com
Sun Oct 27 15:03:16 PDT 2013


Hi,

I want to compute the shortest path between two points
origin=(34.052299,-118.1812657) and destination: (34.141132,-117.853179).

Here is what I tried to do.

*Step 1:* Find the nearest nodes.

*origin: the following returns 590279764*
*
*
SELECT id
FROM nodes
ORDER BY st_distance(the_geom, st_setsrid(st_makepoint(-118.1812657,
34.052299), 4326))
LIMIT 1

*destination: the following returns 123007528*

SELECT id
FROM nodes
ORDER BY st_distance(the_geom, st_setsrid(st_makepoint(-117.853179,
34.141132), 4326))
LIMIT 1

*Step 2:* Compute shortest path between origin and destination.

SELECT *
FROM pgr_dijkstra(
'SELECT gid as id, source, target, length AS cost FROM ways',
 590279764, 123007528, false, false
);

However when I execute this I get the following error.

ERROR:  Start vertex was not found.

********** Error **********

ERROR: Start vertex was not found.
SQL state: XX000

Why is this happening?

Kind regards,
Cathal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pgrouting-dev/attachments/20131027/5976eda4/attachment.html>


More information about the pgrouting-dev mailing list