Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm successfully performing path finding queries like shortest_path on data imported with osm2pgrouting.

The tables I have inside my pgrouting DB are the following:

               List of relations
 Schema |        Name         |   Type   | Owner 
--------+---------------------+----------+-------
 public | classes             | table    | user
 public | geography_columns   | view     | user
 public | geometry_columns    | table    | user
 public | nodes               | table    | user
 public | spatial_ref_sys     | table    | user
 public | types               | table    | user
 public | vertices_tmp        | table    | user
 public | vertices_tmp_id_seq | sequence | user
 public | ways                | table    | user

I get the way of a given path between a source and dest node this way:

SELECT * FROM ways 
   JOIN 
    (SELECT * FROM 
       shortest_path('SELECT gid AS id, source::int4 AS source, target::int4 AS target, length::double precision AS cost FROM ways',3,7,false,false))
   AS route ON ways.gid=route.edge_id;

ways's table has the following structure:

 Table "public.ways"
    Column    |       Type       | Modifiers 
--------------+------------------+-----------
 gid          | integer          | not null
 class_id     | integer          | 
 length       | double precision | 
 name         | character(200)   | 
 x1           | double precision | 
 y1           | double precision | 
 x2           | double precision | 
 y2           | double precision | 
 reverse_cost | double precision | 
 rule         | text             | 
 to_cost      | double precision | 
 the_geom     | geometry         | 
 source       | integer          | 
 target       | integer          | 

Now gid, source and target values aren't original osm node's ids (the node's ids contained in the .osm file from which the table has been filled). I suppose that pgRouting create custom ids in order to index ways and edges. From what I can understand the original ids of nodes contained in the .osm files are the ones listed into nodes table.

I would like, given a row of ways table, recover the original osm id of source and target.

How can I do that?is it possible?

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.