3

I would like to add unique start/end nodes for each feature in my road network. I ran across some posts referencing the pgrouting assign_vertex_id function, which appears to do exactly what I want, but when I try to use it, I get an error saying the function does not exist.

PGRouting is installed and enabled on my database. Using

SELECT pgr_version();

I can see that I am running 2.1.0. Was this function removed at some point, and if so, is there a good alternative in place?

Update, here is the code I am trying to run, where tucson is a table of roads and the geometry is a Linestring

ALTER TABLE tucson ADD COLUMN source integer;
ALTER TABLE tucson ADD COLUMN target integer;
SELECT assign_vertex_id('tucson', 0, 'geom', 'gid');

And then I get the following error:

ERROR:  function assign_vertex_id(unknown, integer, unknown, unknown) does not exist
LINE 3: SELECT assign_vertex_id('tucson', 0, 'geom', 'gid');
           ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
0

2 Answers 2

4

I am running pgrouting version 2.0.0, and assign_vertex_id or pgr_assign_vertex_id doesn't exist.

To build the topology, I use the function pgr_createtopology. In your case, you could go like this:

ALTER TABLE tucson ADD COLUMN source integer;
ALTER TABLE tucson ADD COLUMN target integer;
SELECT pgr_createtopology('tucson', 0.001, 'geom', 'gid', 'source', 'target');

It will fill columns source and target in the table 'tucson' and creates a vertices table.

In case you have already created the source and target columns , you can omit those two columns and use pgr_createtopology function.

3

According to http://ravi.pckl.me/short/pgrouting-assignvertexid-has-been-renamed/

assign_vertex_id has been renamed to pgr_assign_vertex_id

Can't find much documentation on it, but it's also described in http://themapguyde.blogspot.co.at/2013/04/mapguide-and-pgrouting-shortest-path.html

1
  • Hmm, that function seems to be missing too. Can anyone confirm whether or not they have it?
    – wmebane
    Mar 15, 2016 at 21:20

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.