Description
Background: I want to make conditional restriction working, e.g. no_left_turn@12:00-18:00
, as far as I know, the method is using following preprocess commands:
osrm-extract --parse-conditional-restrictions ...
osrm-partition ...
osrm-customize --parse-conditionals-from-now <utc timestamp> --time-zone-file <timezone geojson> ...
For now it somehow works: if the first time do osrm-customize
with a timestamp at 10:00
, the above restriction is inactivated, and then if do osrm-customize
with a timestamp at 13:00
, then above restriction will become activated.
The problem is: if then we do osrm-customize
again with a timestamp at 19:00
the restriction is still activated (should not because 19:00
is not between 12:00-18:00
).
I tried to read the source code of related part, this is my understanding:
turn weight stored in .osrm.turn_weight_penalties
file, when osrm-customize
executed with conditional restriction parameters, it will load .osrm.turn_weight_penalties
file and update/overwrite related weight with an max turn weight value (max float or int) if conditional restriction should activate according to passed-in timestamp, and then write it out. So the previous turn weight is lost as long as the restriction become activated once.
My question is: is my understanding correct? If it works by design then how to make conditional restriction switch between activated and inactivated repeatedly with only osrm-customize
?
PS: A simple solution maybe:
osrm-cutomized
without conditional restriction parameters to make sure no conditional restriction overwrite native turn weight.- backup the
.osrm.turn_weight_penalties
file - every time do
osrm-cutomized
again first copy to.osrm.turn_weight_penalties
from the backup file
Or is there some better method?
Thanks for reading!