In a specific geographic area, I have a road layer and roughly 30 points dispersed around the geographic area as part of a point layer. Both layers are in SHP and PostGIS formats. The records from the point layer correspond to "stops" on the road layer.

How can I calculate the "furthest driving distance at any point in the network to the nearest 'stop' distance is ..."? and as a follow up, can I save that route, or show the furthest points as a different layer?

I'll be using QGIS and OSM or my own road layer data for this.

2 Answers 2


EDIT: This looks like a QGIS plug in that does routing, but it would be a manual / repetitive process:

Possibly easy to fork the code.

Unless you want to write a nice A* algorithm yourself in whatever scripting language QGIS employs you should check out the existing applications / frameworks that can do this for you.

Alternatively, if you do want to 'get right in there' and have a decent level of scripting knowledge, then you need to look at A* algorithms. There are a few references here and there, but this play-list explains it quite well:


Note that if you're using OSM, you will need to have the raw OSM format (ie. ways and nodes), and not the data that has been processed to make it easier to symbolize / render. Reason being, processed data is not route-able. When processing the data, we sacrifice that feature for rendering speed. (Osmosis does, I believe, preserve the ways and nodes in a 'staging' fashion when importing to PostGIS.) That being said, each routing system is going to require a different input format.

On top of that, you're probably not going to get very far wanting to do this 'inside' of QGIS as most of these routing packages are standalone at best. I'd recommend that you look at the C# / Java implementations unless you're feeling brave or have rudimentary c++ knowledge.

As far as retaining your routing results as a separate layer, if you're still with me on this, and you've successfully 'routed' your 'stop' points with one of the suggested packages, I have a feeling that you will know how to do that.

As a final note, if you're using your own road data, it better be topologically correct, otherwise you add a logarithmic level complexity to the search algorithm (speaking from painful personal experience).

  • I'm still working on this. I've made some headway but haven't solved the problem totally. I'll keep you posted.
    – dassouki
    Aug 9, 2012 at 23:18
  • No worries. Feel free to edit your question if you have any additional stumbling blocks.
    – nagytech
    Aug 10, 2012 at 0:38

If I understand your question correctly, you are trying to answer a similar question to the one I answered in http://underdark.wordpress.com/2011/02/12/drive-time-isochrones/ where I calculated drive times from every point in the network to airport locations.

It should be straightforward to adjust this method based on PostGIS and pgRouting.

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.