[OSRM-talk] profile.lua car.lua tuning

Daniel Hofmann hofmann at mapbox.com
Thu Nov 5 17:18:53 UTC 2015

Depending on your use case (maybe only a few larger cities?) and if it has
to scale, you could do the following (disclaimer: a bit hacky).

Take a look here: this is what gets exposed to the profiles for ways:


If your use case allows for it, you might as well do distance calculations
based on the coordinates against the nearest city center (that you somehow
obtain and store, e.g. querying the largest n cities and hardcoding their
coordinates, maybe borders as well).

This would allow you to heuristically fine tune a correction coefficient,
influencing the speed values depending on city center proximity.

On Thu, Nov 5, 2015 at 3:35 PM, Michael Chesterton <michael at chesterton.id.au
> wrote:

> Hello,
> A bit of a long one.
> I've read a few messages from this list about tuning car.lua,
> not all of them yet, but the ones i have read were different
> problems, my problem is it's too fast. If a trip would take 30
> minutes in real life, osrm might say it takes 20 minutes.
> primarily because of congestion in the city.
> Firstly I can lower the speed of roads, and that works in the city,
> but now trips 30+km outside the city are too slow.
> If I penalise traffic lights more (the default is 2, and I think that
> is 2 seconds based on a comment in another lua file, which to me
> is surprisingly short) osrm starts going to great lengths to avoid them,
> with lots of turns. So I penalise turns more, then i mess up the
> penalise right hand turns more than left hand turns algorithm,
> and the trip api plans a route with more right hand turns than
> left.
> with a default profile.lua with one change
> local turn_bias                 = 0.7
> everything is good except it's to fast in the city.
> If I make one extra change,
> local turn_penalty              = 40
> which is too expensive, but i'm just testing, it starts favouring
> right hand turns.
> Can someone make sense of this and offer a fix or a suggestion?
> Maths and computer science algorithms aren't my strong point.
> If I do the turn calculations by hand for a 90 degree turn,
> right hand turns cost 57
> left hand turns cost 28
> further testing
> local turn_penalty              = 20
> favours left hand turns, good. then I make one more change
> traffic_signal_penalty          = 20
> and it starts favouring right hand turns again :(
> another question, assuming 3 left hand turns around the block cost
> more than 1 right hand turn, does the turn bias affect viaroute, or is
> it mainly only trip?
> _______________________________________________
> OSRM-talk mailing list
> OSRM-talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20151105/f7f45db1/attachment.html>

More information about the OSRM-talk mailing list