'Can I Use "Travel time models" in OSRM?

I have the OSRM setup up and running in my CentOS 7 and I have used car.lua profile with little modification to extract the osm data.

Also, with the GPS traces I have(which further converted to gpx format) I generated real "travel time models" using the below programs.

http://wiki.openstreetmap.org/wiki/Routing/Travel_Time_Analysis

and the result wold be like the below:

    <models-db>
    <model node-from="338720677" node-to="832908078" way="214413814" freeflow="5.4" avg-delay="0.9" />
      <model node-from="832908078" node-to="315264821" way="214413814" freeflow="1.0" avg-delay="0.2" />
      <model node-from="315264821" node-to="315264861" way="28682394" freeflow="7.3" avg-delay="2.1" />
      <model node-from="256019073" node-to="256019073" way="30625842" freeflow="18.0" avg-delay="5.9">
        <traffic-delay from="03:15:00" to="07:15:00" day="Any" delay="0.2" />
        <traffic-delay from="15:00:00" to="19:15:00" day="Any" delay="0.9" />
        <traffic-delay from="19:15:00" to="23:30:00" day="Any" delay="5.4" />
      </model>
      ..........
      ..........

Is there a way to use this "travel time model" results in OSRM data as the node-from and node-to are directly connected to the osm node id.

I know we can change the speed (forward and backward) using the lua profile and re populate the data. As the above results gives in time "freeflow" & "avg-delay", I am struggling in using the live travel time models in osrm data.

Also I found the feature "Traffic" in OSRM wiki from the below link

https://github.com/Project-OSRM/osrm-backend/wiki/Traffic

but again we need to give the input as node along with speed(edge_speed_in_km_h).

Thanks in advance.



Solution 1:[1]

Sadly you will need to invest a little effort here to convert the above format into something that OSRM will understand. We use a simple CSV-based schema, and as you already saw we require speed and not duration.

To convert your duration values to speed values you will need to write a conversion tool that does the following things:

  • Read an OSM file and save the coordinate for each node (indexed by OSM node id)
  • Read your XML file and for each model:
    • get the coordinates for node-from and node-to
    • compute the distance between those coordinates
    • divide the computed distance by the desired field you want to extract, e.g. free_flow / distance = speed [m/s]
    • divide the speed in m/s so divide by 3.6 to convert to km/h
    • Save the result as CSV {node_from},{node_to},{speed} for each connected node pairs

I'm assuming here that ?ode-from and node-to are always adjacent. I'm not sure how the format you posted is defined, I could not find a real specification under the link you provided.

OSRM does not deal with time-dependence itself. You need to orchestrate this yourself and provide an up-to-date CSV file for your current model of the road-network.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mrash