4

Could someone share with me some ideas or your experience how to estimate travelling time based on the provided route within pgRouting? The problem is that roads inside and outside cities have the same type (for example "highway=primary") but different max speed allowed. But this max speed attribute is not always set in real OSM data. The only possible solution I see at the moment is to preprocess all roads before calculations and set for each some expected speed. For example, if "highway=primary" and it's inside the city then expected speed is 40km/h, if it's outside then expected speed = 90 km/h. But how to detect that the road is inside some city bounds or not? Any ideas are welcomed!

1
  • also may be there is some possibility to query all roads in the city having its boundaries?
    – Andrew
    Commented Jul 20, 2012 at 13:44

1 Answer 1

1

I don't think you can do this very reliably, since OSM is inherently subject to personal opinion (or at least, local practice).

However I think you could just assume that the expected speed is fixed irrespective of whether you are in a city or not (i.e. just on the highway attribute), if you don't have a more specific detail. Of course, the speed limit might be 60 or 100, but that will be because of the road, not because its in a particular place - could be a bad road out in the country, could be a motorway that goes through a city.

You could do some postgis magic (ST_Within / ST_Contains) if you had city boundaries, and really want to finess it, but I don't think it will really help that much.

1
  • could not agree with you that it would not really help... but thank you for the tip with ST_Within / ST_Contains
    – Andrew
    Commented Jul 20, 2012 at 13:41

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.