0

I'm looking to set up a routing system that will give distances based on network routes, rather than straight lines (ie. ST_Distance).

To do this, I'd like to set up a pgRouting database where the cost associated with the OSM 'classes' are similar to the OSRM project - which gives more realistic directions than the pgRouting example I've set up so far.

What I'm looking for is the class cost breakdown similar to what is in the pgRouting documentation:

UPDATE classes SET cost=1 ;
UPDATE classes SET cost=2.0 WHERE name IN ('pedestrian','steps','footway');
UPDATE classes SET cost=1.5 WHERE name IN ('cicleway','living_street','path');
UPDATE classes SET cost=0.8 WHERE name IN ('secondary','tertiary');
UPDATE classes SET cost=0.6 WHERE name IN ('primary','primary_link');
UPDATE classes SET cost=0.4 WHERE name IN ('trunk','trunk_link');
UPDATE classes SET cost=0.3 WHERE name IN ('motorway','motorway_junction','motorway_link');

Does OSRM use a similar cost scheme? And is it available in their documentation somewhere?

A basic example of the difference is directions from Boulder, CO to my house in Denver, CO: the two systems takes 2 different routes - the OSRM route follows major roads more closely until it needs to take minor roads, while the pgRouting method will take more minor roads, leaving major roads as soon as possible.

3

The costs you mention are from the Workshop (not the documentation and they are pretty much arbitrary. They were just set like this to give an example how to modify costs depending on road classes.

OSRM defines its "costs" in the profile files in the profiles directory, for example for car: https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua

Usually the cost calculation is based on speed, but using the length of the road segment you can calculate the travel time, which would then become your cost.

  • that is a very useful link! – Stophface Dec 16 '16 at 10:59

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.