[GIS] Unable to create topology with pgrouting

pgroutingpostgis

I am just trying to create a sample topology using pgrouting. The dataset I am using is simply two crossing line segments (not connected in the middle because in the future I will have over/underpasses and I want to see how this is handled).

However I keep getting this error:

NOTICE:  PROCESSING:
NOTICE:  pgr_createTopology('test_edges', 0.1, 'id', 'geom', 'source', 'target', rows_where := 'true', clean := f)
NOTICE:  Performing checks, please wait .....
NOTICE:  ----> PGR ERROR in pgr_createTopology: Column source not found
HINT:    ----> Check your column name
CONTEXT:  SQL statement "SELECT _pgr_onError(err, reportErrs, fnName,  'Column '|| col ||' not found', ' Check your column name','Column '|| col || ' found')"
PL/pgSQL function _pgr_getcolumnname(text,text,text,integer,text) line 18 at PERFORM
SQL statement "select *                 from _pgr_getColumnName(sname, tname,source,2,fnName)"
PL/pgSQL function pgr_createtopology(text,double precision,text,text,text,text,text,boolean) line 61 at SQL statement
NOTICE:  Unexpected error raise_exception
Total query runtime: 64 msec
1 row retrieved.

The table name is "test_edges" and it has two columns, "id" and "geom". I am using this query:

select pgr_createTopology('test_edges', 0.1, 'id', 'geom');

This is the table I am using:

enter image description here

Does anybody know why this would not work?

Best Answer

Add source and target columns to your table.

Related Question