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.

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

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

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.