Yes, osm2postgis does not split roads in intersections (or actually it does vice versa: merges them), so you can technically try pgrouting for it, but it only uses final road ends, so it works only in some special cases. Been there, done that :).
I tried to"post-fix" the postgis database using some road cutter (I found best tool from ArcMap and no free alternatives, except maybe Grass) . The issue is still that it would cut roads in all intersections, where roads actually do not intersect (multi-level intersections). So correct solution would be to use osm2pgrouting tool instead to convert directly from .osm file to the pgrouting tables. But last time when I tried it it worked with limited areas (e.g. whole Germany was too big). Maybe this is fixed now Jaak 2010/5/18 Tristram Gräbener <[email protected]>: > Hello, > > Correct-me if I'm wrong, but osm2postgis is not meant for routing. > According to http://wiki.openstreetmap.org/wiki/Osm2pgsql > "this means that you can't tell which linestring is connected to > which, but for rendering a map that's not important (c.f. routing)" > > Generaly OSM data has correct intersections for routing (of course the > are exceptions). > So my guess would be that osm2pgsql is not the right tool for routing. > > In OSM a way is not an arc in routing graph. You have to split the way > in multiple arcs > > I hope this will help you > > On Tue, May 18, 2010 at 1:38 PM, roshni.spain <[email protected]> wrote: >> >> 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 >> >> -- >> View this message in context: >> http://gis.638310.n2.nabble.com/OpenStreetMap-osm2pgsql-pgRouting-into-Postgis-tp5069564p5069564.html >> Sent from the Routing mailing list archive at Nabble.com. >> >> _______________________________________________ >> Routing mailing list >> [email protected] >> http://lists.openstreetmap.org/listinfo/routing >> > > _______________________________________________ > Routing mailing list > [email protected] > http://lists.openstreetmap.org/listinfo/routing > -- Jaak Laineste _______________________________________________ Routing mailing list [email protected] http://lists.openstreetmap.org/listinfo/routing
