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 using using OSgeo 6.5 dvd and studing pgrouting workshop (link) for get shortest path. I created network topology call "pgrouting - workshop". There are three commands to execute in section 5.2 they are :

-- Add "source" and "target" column
ALTER TABLE ways ADD COLUMN "source" integer;
ALTER TABLE ways ADD COLUMN "target" integer;

-- Run topology function
SELECT assign_vertex_id('ways', 0.00001, 'the_geom', 'gid');

Add source and target was executed successfully. topology function give errors. Heres the error :

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
ERROR:  function startpoint(geometry) does not exist
LINE 1: SELECT gid AS id, StartPoint(the_geom) AS source, EndPoint(t...
                      ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:  SELECT gid AS id, StartPoint(the_geom) AS source, EndPoint(the_geom) as target FROM ways
CONTEXT:  PL/pgSQL function "assign_vertex_id" line 27 at FOR over EXECUTE statement

How do i fix this error?

I loaded the legacy.sql and noted that error has little bit changed :

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
ERROR:  function point_to_id(geometry, double precision) does not exist
LINE 1: SELECT point_to_id(setsrid(_r.source, srid), tolerance)
           ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:  SELECT point_to_id(setsrid(_r.source, srid), tolerance)
CONTEXT:  PL/pgSQL function "assign_vertex_id" line 33 at assignment
share|improve this question
add comment

1 Answer 1

The version of pgRouting installed on the OSGeo LiveDVD 6.5 is not fully working with PostGIS 2.0, but you can solve most issues by loading the legacy.sql file to your database:

\i /usr/share/postgresql/9.1/contrib/postgis-2.0/legacy.sql

In most cases when an errors occurse, pgRouting functions are missing the ST_ prefix, for example ST_StartPoint(the_geom).

share|improve this answer
    
I loaded the legacy.sql but issue was stil there. How do i add the ST_ prefix to assign_vertex_id('ways', 0.00001, 'the_geom', 'gid'); Where should I add it? I think it must be like this SELECT "ST_assign_vertex_id('ways', 0.00001, 'the_geom', 'gid');" –  smk Jun 2 '13 at 5:13
    
docs.pgrouting.org/dev/src/common/doc/functions/… if you use latest pgrouting. Or you can also create topology using (fastest method for big datasets) pgrouting.org/docs/howto/topology.html#grass –  simplexio Aug 31 '13 at 19:01
add comment

Your Answer

 
discard

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.