I'm using OSgeo 6.5 dvd and studing pgrouting workshop for get shortest path. I created database call "routing" and used "template_routing" for create tables but only 3 tables created. So then I executed following commands

# become user "user" (or run as user "user")
sudo su user

# create routing database
createdb routing
createlang plpgsql routing

# add PostGIS functions
psql -d routing -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
psql -d routing -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql

# add pgRouting core functions
psql -d routing -f /usr/share/postlbs/routing_core.sql
psql -d routing -f /usr/share/postlbs/routing_core_wrappers.sql
psql -d routing -f /usr/share/postlbs/routing_topology.sql

then 7 tables created but few tables are missing when compare to workshop..

Workshop output;

List of relations
Schema |        Name         |   Type   |  Owner
public | classes             | table    | postgres
public | geometry_columns    | table    | postgres
public | nodes               | table    | postgres
public | spatial_ref_sys     | table    | postgres
public | types               | table    | postgres
public | vertices_tmp        | table    | postgres
public | vertices_tmp_id_seq | sequence | postgres
public | ways                | table    | postgres
(8 rows) 

My output;

List of relations
Schema |       Name        | Type  | Owner 
public | classes           | table | user
public | geography_columns | view  | user
public | geometry_columns  | view  | user
public | nodes             | table | user
public | spatial_ref_sys   | table | user
public | types             | table | user
public | ways              | table | user
(7 rows)

I got error like this

NOTICE:  CREATE TABLE will create implicit sequence "vertices_tmp_id_seq" for serial column "vertices_tmp.id"
CONTEXT:  SQL statement "CREATE TABLE vertices_tmp (id serial)"
PL/pgSQL function "assign_vertex_id" line 15 at EXECUTE statement
size of streets: 4093
size of splitted ways : 17328

when executing this command

osm2pgrouting -file "data/sampledata.osm" \
                      -conf "/usr/share/osm2pgrouting/mapconfig.xml" \
                      -dbname routing \
                      -user user \

how do I get create missing tables

1 Answer 1


The vertices_tmp table should be created by the assign_vertex_id() function, e.g.:

SELECT assign_vertex_id('ways', 0.00001, 'wkb_geometry', 'uid');

This will populate the "ways" table with vertex id for source and target ends of the road links got from the vertices_tmp table.

Should the command be run as the "postgres" user who owns the public schema rather than "user" who might not have permissions to execute the functions? I had to move my tables from my "routing" schema to the "public" schema before it worked using the "postgres" user.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.