1

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?

2
  • I'd start with adding both source and target columns to the given table before requesting the topology creation. Commented Apr 11, 2017 at 12:37
  • Thank you @Michal Zimmermann, that was it. I did not realize that the source and target columns needed to already exist in the table.
    – wfgeo
    Commented Apr 11, 2017 at 12:57

2 Answers 2

5

Add source and target columns to your table.

1
  • what does this mean?
    – sutan
    Commented Mar 28, 2022 at 9:54
1

For example, see http://workshop.pgrouting.org/2.4.11/en/chapters/topology.html, which shows altering the table to add the source and target columns.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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