osrm-backend icon indicating copy to clipboard operation
osrm-backend copied to clipboard

[question] Traffic - reset weights?

Open mbukovy opened this issue 8 years ago • 6 comments

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

mbukovy avatar Jun 20 '18 08:06 mbukovy

@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 avatar Jun 20 '18 11:06 TheMarex

@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 avatar Jun 20 '18 11:06 mbukovy

@mbukovy

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

mzervens avatar Oct 02 '18 09:10 mzervens

@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 avatar Oct 02 '18 12:10 mbukovy

@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 avatar Oct 03 '18 12:10 mzervens

@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).

mbukovy avatar Oct 04 '18 09:10 mbukovy