I have a PostGIS database and I need to figure out a quick (in terms of setup) way of calculating the travel-time between points corresponding to geocoded addresses taking into account the route and speed-limits involved. It looks like the pgRouting extension combined with OSM data is going to be my best bet (although please correct me if there's a better alternative). Before I start going down that route, however, I was wondering if someone could just confirm whether or not I'm going to need any additional steps/data/software in order to do what I need? The points I have are within the US states of PA, NJ and DE.

  • What exactly do you need? – Hasan Mustafa Apr 9 '16 at 19:11
  • Given two features, I need to get the travel-time between them, taking into account the route itself and the speed-limits involved. – Matthew Delaney Apr 9 '16 at 19:22
  • Please edit your answer to include any extra info rather than adding it as a comment. – Midavalo Apr 9 '16 at 19:28
  • Since you're asking for additional steps, what steps do you already have? Do those steps worK? – Midavalo Apr 9 '16 at 19:30
  • OK, I edited the question to include my clarification. I'm asking if I would need any additional steps on top of simply installing pgRouting and importing OSM data. I haven't done that yet. – Matthew Delaney Apr 9 '16 at 19:53

In pgRouting the the shortest path function(s) return the route with the lowest cost between two points. If your cost attribute is "time", then your shortest path will be the quickest route.

I recommend you to start with the pgRouting workshop, which explains about variable costs as well: http://workshop.pgrouting.org/chapters/advanced.html

  • Thanks for this. Having gone through the workshop, it looks like I can accomplish what I need with the OSM data by using the fact that the cost stored is the length and that each tuple in the 'ways' table has an associated road-class. The road-classes allow max speed-limits to be stored so it should be possible to calculate approximate travel-time based on that. – Matthew Delaney May 1 '16 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.