[postgis-users] OpenStreetMap + osm2pgsql + pgRouting into Postgis

Roshni Budhrani roshni.aruna at gmail.com
Tue May 18 04:31:17 PDT 2010


Hi,
    could you please help me into this matter. The scenario is the
following:

    I have got OSM data that has been inserted into PostGIS using osm2pgsql.
I have used MapServer to interact with my map through OpenLayers and this
works perfectly fine.
    On the other side, I need to use pgRouting to use the algoritms of
shortest_path or dijkstra to find a route between A and B and show it with
OpenLayers. I have managed to do this with OpenLayers, so i know that if the
algorithms return any result, the calculated rout shows properly in my
browser. BUT, my problem is that in most of the cases, my algoritms do not
return any result... lets say maybe 80-90% of the times there is no route
calculated. What can i do ??

    My geom table has got the values x1,y1,x2,y2,source,target filled for
all the rows.

    The columns source and target are filled using this:
    SELECT assign_vertex_id('planet_osm_line', 5, 'the_geom', 'gid');

    As for the columns x1,y1,x2,y2, these are filled using this:
    SELECT astext(StartPoint(way)) as startpoint from planet_osm_line =>
used to fill up x1, y1
    SELECT astext(EndPoint(way))as endpoint from planet_osm_line => used to
fill up x2, y2

    I really dont know where the problem could be, as all the rows are
filled up and the data seem correct...

    Looking further into the matter,
    i have noticed that the only cases where i have managed to get some
result with the shortest_path function is when there is a straight line
between A and B, but if i need to do A and C, and there is no straight line
between them (suppose something like A => B => C), then no result will be
returned :(

    The same applies for other routing algorithms ... and still no clue


    I have been told that this is probably because the OSM data is not
properly noded at all intersections. If it is so, then how can i fix my
data?

Thank you all
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100518/8478cd01/attachment.html>


More information about the postgis-users mailing list