is possible to force osm2po to reroute when traffic jam or other problem is detected on the route ? Or is it possible to tell osm2po routing to avoid some node/way even when it is best route ?

I'm not Java programmer so I prefer non Java solution

  • What do you mean? pgRouting or osm2po-REST (http/geojson) ? ... and no, there is currently no default handling for this. You need Java Skills in order to modify the routing behavior to your needs.
    – Carsten
    Jul 16, 2013 at 10:22
  • Any updates on your problem?
    – dassouki
    Jul 20, 2013 at 17:51
  • no, not yet, it look like i have to learn java to be able to affect routing .. or to use different routing engine which i do not want - i like osm2po, for me it's fast and easy to use ...
    – Matus
    Jul 23, 2013 at 11:33

1 Answer 1


Both methods outlined below provide solutions from a transportation rather than a computer science based approach.

Method 1

The way this is done properly in Travel Demand Modelling (TDM) is in the Trip Assignment stage of the model.

Using the FHWA model, you can do the following:

  • In your layer, create a new column for each time period you're modelling for:
    • A new field called Volume
    • A new field called Time_to_traverse
    • Create a new column for each time period you're modelling and let's call it capacity
  • You either have to compute Volume of Traffic using Trip Distribution models or existing traffic feeds
  • Capacity as as a start could be assumed as 1600 passenger vehicles per lane per hour.
  • V/C = Volume over capacity tells you how full the highway is

Use the following equation to estimate the Time to traverse the link:

Ti = T_o [1 + 0.15*(V/C)^4]


  • T_i = Balanced (iterative approach)
  • T_o = free flow travel time
  • V = assigned volume for that link
  • C = practical capacity

Now that you have your Volume, Capacity, and Time to traverse fields for your time periods, you can set up your model to traverse using cost=time_to_traverse rather than cost=link_length. when V/C approaches one, time_to_traverse will go up and the model will reroute accordingly

Method 2:

  • Create two field in your layer: Virtual_length, and virtual_factor
  • If you know when volumes or traffic jams are going to occur on certain roads, assign those roads a Virtual factor and Virtual_length = Virtual_factor * real_length

  • Route based on Virtual_length

Final Note:

I think this is a traffic engineering and modelling exercise more so than a programming problem

  • Your solution is too sophisticated for data i can use ... I have just information that on some road is traffic level 5 which mean complete stuck and i want to recalculate navigation route to avoid this place/node. I know this is complicated problem but i want to do simple even not so perfect solution ( informations what is traffic jam and what is jam level is not from me ... )
    – Matus
    Jul 15, 2013 at 11:56
  • In the case where they have a level of service, indicated by numbers assuming 1 to 5. I assume 1 is free flow, 4 is equilibrium and 5 is failure. you can use those as your fudge factor? or can you deduce some fudge factors from them and try to apply method 2?
    – dassouki
    Jul 15, 2013 at 12:01
  • when you speaking about layer, you mean layer in osm2po ? I'm i able to change database data in routing engine ? I'm sorry if it is dump question but i'm using osm2po as routing engine with json, and i was never digging inside it to see how it work or what else it can do. thanks
    – Matus
    Jul 16, 2013 at 8:51

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.