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 have a road network where I do a driving distance operation through pgrouting. This is my SQL:

SELECT * FROM driving_distance('SELECT gid AS id,source,target, cost FROM elveg',676663,1000,false,false);

From this query I get a strange result: http://bildr.no/view/1373984

Black is my road network and green is the result from the above query. From the image you see that some edges are not included(not green) while edges which can only be connected through this not included edge in fact is included?

How can this be? Am I doing something totally wrong here?

share|improve this question

2 Answers 2

You have created routing table with too big tolerances.

When you have linestring table and you create edge/vertex table for routing algorithm, you need to give tolerance. For example

        |  a-line
c-line /
        |  -b-line

In example both a and b line should intersect at "o" but something went wrong somewhere. So easy "fix" is use that "1m" tolerance, but it his example it would probably "eat" c-line away because its lenght is "1m"

third edit: now that i picture again, it just looks like you routing edge/vertex table is broken, try regerate it using sane tolarenace see for howto "http://pgrouting.org/docs/howto/topology.html#pgrouting"

This one seems to be good example howto do it http://pgrouting.org/docs/foss4g2008/index.html

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Hi, could you add more details? –  R.K. Jan 27 '13 at 6:28
What do you mean simplexio? I use this table for regular shortest path routing and it works fine for that? –  Espen Jan 27 '13 at 20:51
It's been a while i last time used pgrouting, but i think it need its own table . i mean "assign_vertex_id('<table>', float tolerance, '<geometry column', '<gid>')" functio which creates network topology from table –  simplexio Jan 28 '13 at 8:16
At the moment assign_vertex_id gives an error. So something is not working right here :-) ERROR: query string argument of EXECUTE is null CONTEXT: PL/pgSQL function assign_vertex_id(character varying,double precision,character varying,character varying) line 36 at EXECUTE statement –  Espen Jan 30 '13 at 12:43
CREATE OR REPLACE FUNCTION assign_vertex_id(schema_name varchar, geom_table varchar, tolerance double precision, geo_cname varchar, gid_cname varchar) Is in latest version , so you need add schema there –  simplexio Jan 30 '13 at 12:55

I believe you may be running in to a known bug in pgrouting. the driving_distance function basically returns the cost to a node, not the cost to an edge, and the edge_id it returns is not necessarily the one it traversed to get to a node, and not all edges traversed will necessarily be included in the results.

note: https://github.com/pgRouting/pgrouting/issues/51

also note that in the documentation for 2.0 (http://docs.pgrouting.org/2.0/en/src/driving_distance/doc/dd_driving_distance.html#pgr-driving-distance), it's indicated that edge_id is "probably not a useful item". I'm currently in the process of determining whether this is still a bug in 2.0.

share|improve this answer
Ok, thanks for your reply. I am not currently working with this stuff anymore so I am not able to test it out. –  Espen Nov 13 '13 at 7:17

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.