I would like to generate a catchment within a network, up to a max cost, using the pgr_drivingDistance function. This returns all the nodes within this distance - but does not provide for partial edges to be split and terminated when the max cost is reached part of the way through the edge.

This is related to the answer in Return nodes along portions of edges with pgrouting but I am repeating it here, as I wonder whether the situation has progressed in the last three years. A duplicate is here PgRouting - How to clip links when reaching max costs? but with unsatisfactory answers that are fairly old.

A visualisation of a similar process through interpolation (post-hoc)is here: https://anitagraser.com/2017/09/11/drive-time-isochrones-from-a-single-shapefile-using-qgis-postgis-and-pgrouting/ - yet, it does not retrieve the part-way points.

1 Answer 1


I'm sure there is other, maybe simpler way, but I did it as follows:

  1. created new table (t1) using driving distance
  2. created another table as select from t1 with all edges which have cost < defined (t2).
  3. created third table (t3) as select all edges from t1 which are not in t2, but intersecting edges from t2.
  4. Reversed all lines that are leading to center not from center, so next step will cut a line from proper side.
  5. counted what part of edge should be attached to t2 and cut lines using st_lineLocatePoint and delete edges not intersecting with t1
  6. now you can do st_concaveHull or ConvexHull on union of t1 and t2.

On the last step instead of concave I made st_buffer simulating driving offroad with some defined speed - it's counting little longer but looks better

enter image description here

  • Thank you - I was after roughly the same procedure. Mind sharing scripts? In particular, how do you define step 4 and the direction from/to center? Purely based on distance between start and end point? In step 5, how do you know the cost travelled so far? There may be different answers for multiple paths ,too, so you want the min I guess.
    – MartinT
    Mar 4, 2018 at 22:02
  • Mind few beers for that? ;) gist.github.com/jendrusk/675eeeed1f3984301e792eabd7ca8ef9
    – Jendrusk
    Mar 6, 2018 at 11:07

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.