Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi all and thanks in advance.

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?

Best regards from Portugal, Tiago

share|improve this question

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:

Also it's not possible anymore to have a geometry type MULTILINESTRING, so osm2pgrouting requires the following fix:

share|improve this answer
Thanks Dkastl, i'll give it a try and post the results. thank you again for your answer and time. – Tiago Matias Rogério Sep 26 '12 at 13:29

Your Answer


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

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