[pgrouting-users] Shortest Route Search Not Working

Yasir Shoaib yasirshoa at gmail.com
Thu Jul 15 21:40:58 EDT 2010


Hello,

I am trying to have routing working for city of Toronto data. But,nothing
shows up and a problem is seen in the FindNearestEdge() method.

One example request sent to the routing php is as follows:
routing.php?startpoint=-8837720.7293944
5412947.799546&finalpoint=-8836963.525083
5412307.6394342&method=SPD&srid=900913

My understanding is that projection for the pgRouting database is 4326 and
for the tiles displayed in
OpenLayers<http://pgrouting.postlbs.org/wiki/OpenLayers>it is 900913.
(In the code both the html and php projection values are set
to 900913. However I am not clear as to how to make the projection changes
-- whether modify the pgRouting database or change
OpenLayers<http://pgrouting.postlbs.org/wiki/OpenLayers>HTML page).

Further details are below
------------------------------

- The tiles were rendered through generate_tiles.py script of postgis
database for Toronto routes. I found Ontario.osm and then extracted city of
Toronto osm data. Then, created the pgRouting database. Now my map displays
the tiles correctly in 900913 projection.

- I am not sure but maybe the pgRouting database is 4326 projection, because
for A* search the x1,y1... are shown in latlng. ...?

The HTML page is very similar to:
http://pgrouting.postlbs.org/wiki/Workshop-RoutingRequest Except that
instead of 54004 projection, I use 9000913 projection.

The php page is same as
http://pgrouting.postlbs.org/wiki/Workshop-ClosestEdge Again I have set
projection to 900913 here.

 Code snippet:

 ...

 $sql = "SELECT gid, source, target, the_geom,astext(the_geom),

 distance(the_geom, GeometryFromText?(

 'POINT(".$lonlat[0]."
".$lonlat[1]<http://pgrouting.postlbs.org/changeset/1>.")',
900913)) AS dist

 FROM ".TABLE." WHERE the_geom && setsrid(

 'BOX3D(".($lonlat[0]-200)."

 ".($lonlat[1] <http://pgrouting.postlbs.org/changeset/1>-200).", ".($lonlat
[0]+200)." ".($lonlat[1]
<http://pgrouting.postlbs.org/changeset/1>+200).")'::box3d,
900913)

  ORDER BY dist LIMIT 1";

 ...

The problem is when the php script runs, findNearestEdge() method doesn't
work and one warning as followed shown:

PHP Warning: pg_fetch_result(): Unable to jump to row 0 on PostgreSQL result
index 3 ...

I am not sure of the problem. Please, if you have ideas let me know.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20100715/f1e5bad9/attachment.html


More information about the Pgrouting-users mailing list