简体   繁体   中英

Postgres pgrouting2 Dijkstra shortest path returns edges that don't exist

I am struggling with a very strange problem for a few days now that I can't find a solution. I am using postgresql 9.3 with postgis 2 and pgrouting 2 extentions. I have imported OSM data for a city and created topology network successfully with pgr_createTopology() function. I can successfully find shortest path with Dijkstra algorithm by executing for example (ignore the simplified cost function)

 SELECT * from pgr_dijkstra(
   'SELECT id, source, target, st_length(way) as cost FROM planet_osm_roads',
    5744, 5900, false, false
    )

and getting the following result (seq,id1,id2,cost)

0;5744;178191032;428.359590042932
1;5749;177327184;61.7533237967002
2;5821;177327456;544.454553269731
3;5833;177338744;51.1559809959342
4;5871;177338880;71.0702814120015
5;5900;-1;0

The problem is that the returning id2 values, which corresponds to the id of the edges, are not present in the planet_osm_roads table. Actually those values cannot be found in any column of planet_osm_roads or planet_osm_roads_vertices_pgr tables. Am I missing something? Maybe someone had faced the same problem before.

Thank you all in advance

What kind of values to you have for edge ids? pgRouting only supports 32 bit integer values, if your ids are larger then they will get silently truncated. This is a known problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM