Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create the routable network as per use assign_vertex_id. Do I still need to create the node table? How would code for creating network look like?

share|improve this question

On this link is a very good tutorial about it.

You don't need the node table, you can use the your original table instead. First you have to add two columns to it, called source and target, both integer. After that you run the assign_vertex_id like this:

assign_vertex_id('<table>', float tolerance, '<geometry column', '<gid>')

So here is the whole code, where "ways" is the tablename:

ALTER TABLE ways ADD COLUMN source integer;
ALTER TABLE ways ADD COLUMN target integer;
SELECT assign_vertex_id('ways', 0.00001, 'the_geom', 'gid');
share|improve this answer
Thanks. I went as far as that. But I am not sure what to do next, how Dijkstra would look like? I guess no other tables are needed? – Pawel Feb 25 '13 at 10:49
Dijkstra looks likes this: SELECT * FROM shortest_path('SELECT gid AS id, source::int4, target::int4, length::double precision AS cost, FROM dourol',3, 7, false, false); where "dourol" is the table name, 3 and 7 are the source and target ids (from the source and target columns which you just created) here are some instructions – ylka Feb 25 '13 at 13:11

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.