I have PostGIS 2.0.1 and PgRouting latest version. I'm using osm2pgrouting to import OpenStreetMap data everything goes OK the trouble is that I always get source and target columns without data and when I run SELECT assign_vertex_id('ways', 0.00001, 'the_geom', 'gid'); by hand on PGSQL I get the following error:

ERROR: syntax error at or near "vertices_tmp" LINE 1: SELECT ST_addGeometryColumn(''vertices_tmp'', ''the_geom'', ... ^

********** Error **********

ERROR: syntax error at or near "vertices_tmp" SQL state: 42601 Character: 31

After hours of reading on the net I've realized that the function assign_vertex_id() had to change somehow because it references other functions like StartPoint that it's called ST_StartPoint and I've changed that but I still get errors.

Where can I get the .sql file with the proper SQL to make the upgrade and postgis/pgrouting can work together?

1 Answer 1


The assign_vertex_id function of pgRouting, that is used to build the road network topology, doesn't work with PostGIS 2.0 (yet), because it still makes use of a few PostGIS functions without "ST_" prefix. Here is an updated function that should work: https://github.com/mbasa/pgrouting/blob/master/core/sql/routing_topology.sql

Also it's not possible anymore to have a geometry type MULTILINESTRING, so osm2pgrouting requires the following fix: https://github.com/pgRouting/osm2pgrouting/commit/2a20f6e9b1c7ae34e7f60246aa4c7679cfe59e80

  • Thanks Dkastl, i'll give it a try and post the results. thank you again for your answer and time. Sep 26, 2012 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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