Osrm-backend: [question] Traffic - reset weights?

Created on 20 Jun 2018  路  6Comments  路  Source: Project-OSRM/osrm-backend

Hello,

I'm using OSRM with traffic and everything works well. But I wonder, is there any option to "reset" rates for node pairs? For example, if there is a closed road from 1st to 10th of January, then:

  1. export update csv with X rows like id1,id2,speed,rate (set to "don't route there")
  2. call osrm-customize --segment-speed-file update.csv
  3. restart osrm-routed, new updates are in use
  4. 11th January, I need to reset these nodes to the original value (original speed and rate).
    Am I able to restore it somehow? Or just say "reset these nodes to default"?

Thank you!
Michal

Most helpful comment

@mzervens
No no no :-)
When you open car.lua file, you can find the speeds this profile uses while doing osrm-extract. You can see it here https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua#L139 These speeds are "original" speeds.
So I just used the same speed-map in my own script. I have loaded desired map from geofabrik and created my own database of speeds for every node (based on highway attribute, same as in car.lua file).

All 6 comments

@mbukovy you would need to do this state handling outside of OSRM. If you preserve the original .osrm.ebg and .osrm.turn_{weight,duration}_penalties and .osrm.geometries files before you run osrm-customize you can always revert back to the "default" by overwriting your updated files.

@TheMarex
But this overwrites the whole graph, right? I need to restore only given nodes and preserve the other, still valid updates (done between 2nd and 10th of January from my example).
So as far as I understand, this is not doable now...?

Edit: I've done this outside of OSRM. I always get the original speeds and rates and save it, so I can restore it whenever I want. Closing the issue.

@mbukovy

And how did you manage to get the original segment speeds?
There is no HTTP api for that :[

@mzervens I have saved all the nodes into sqlite database (exported from OSM data) with original speeds set based on car.lua profile. Therefore I can get original metadata for every node I need, whenever I need.

@mbukovy

Could you explain in more detail how you managed to get the speed data using the car.lua profile file?
As I understand the process:

  • you have .osm base data
  • you feed this data and the profile to osrm-extract
  • osrm-extract uses the profile functions to calculate internal road network, where the nodes, speeds are stored

@mzervens
No no no :-)
When you open car.lua file, you can find the speeds this profile uses while doing osrm-extract. You can see it here https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua#L139 These speeds are "original" speeds.
So I just used the same speed-map in my own script. I have loaded desired map from geofabrik and created my own database of speeds for every node (based on highway attribute, same as in car.lua file).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

koussaimb picture koussaimb  路  4Comments

JamesLawrenceGSI picture JamesLawrenceGSI  路  3Comments

rachha picture rachha  路  4Comments

Oyabi picture Oyabi  路  5Comments

freenerd picture freenerd  路  4Comments