0

I started working with pgr_drivingDistance. Lot of edges (marked as yellow) are missing from result.

Those seem to be cases, where routing algorithm has approached to same edge from two directions.

Is such result normal and expected?

I can fix those missing edges with separate queries, but at first I would like to be sure, that I haven't messed something up myself.

EDIT: I have added some post processing now to fix those missing edges.

Driving distance result, yellow roads are missing

I have used different software versions (Win platform): latest versions (Postgres 11 + PostGIS 2.5 + pgRouting 2.6) and Postgres 9.6 + PostGIS 2.4 + pgRouting 2.3. Results are identical.

5
  • You are likely considering road segments as unidirectional, which leads to artistic (and frustrating) results. Check the queries and their parameters, you may have to explicitly give a reverse cost for each segments (like cost = reverse cost = segment length)
    – JGH
    Commented Mar 27, 2019 at 18:47
  • Thanks, that's one thing to suspect for such result - but reverse_cost is set up correctly. Commented Mar 28, 2019 at 6:03
  • I'd be interested to investigate; could you share the example from above? and add the queries you mentioned to the question?
    – geozelot
    Commented Mar 28, 2019 at 8:04
  • @ThingumaBob Thanks for your offer - but as it turns out from Vicky's answer, that result is correct. Commented Mar 29, 2019 at 10:07
  • During my work, I found a bug, related to equicost parameter of pgr_drivingDistance, though. Commented Mar 29, 2019 at 10:08

1 Answer 1

1

From: http://docs.pgrouting.org/2.6/en/pgr_drivingDistance.html#synopsis

Using the Dijkstra algorithm, extracts all the nodes that have costs less than or equal to the value distance. The edges extracted will conform to the corresponding spanning tree.

"extracts all the nodes that have costs less than or equal to the value distance." So you get to the nodes within the driving distance

"The edges extracted will conform to the corresponding spanning tree." The edges posted on the result are the ones that get you to the nodes within the driving distance.

So, say if G has nodes 1,2,3 and has edges 1->2 1->3 2->3 and for simplicity all edges have cost 2. starting from node 1:

  • Nodes within driving distance of 1: 1 with cost 0 and total cost 0 (no edge)
  • Nodes within driving distance of 2: 1, 2, 3 edges involved on the spanning tree: 1->2 & 1->3
  • Nodes within driving distance of 6: 1, 2, 3 edges involved on the spanning tree: 1->2 & 1->3
    • Edge 2->3 is not missing because its not in the spanning tree of the solution.
2
  • Thanks! It makes perfect sense now, with help of example about driving distnce of 6 (but I guess, there's a typo, do you mean "edge 2->3 is missing because..."). I hope, this will help other fellows as well, my initial googling didn't give much info. Commented Mar 29, 2019 at 10:04
  • Edge 2->3 is not missing on the spanning tree, as is not part of the spanning tree.
    – Vicky
    Commented Mar 29, 2019 at 13:44

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.