1

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

geoandri
  • 2,360
  • 2
  • 15
  • 28

1 Answers1

3

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.

Stephen Woodbridge
  • 1,100
  • 1
  • 8
  • 16
  • Many many thanks. That was the exact problem. The column type was bigint in postgres. You really saved my day. Thank you. – geoandri Dec 19 '14 at 09:54