Skip to content

osrm-customize with conditional restrictions multiple times  #6117

Open
@fubupc

Description

@fubupc

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:

  1. osrm-cutomized without conditional restriction parameters to make sure no conditional restriction overwrite native turn weight.
  2. backup the .osrm.turn_weight_penalties file
  3. 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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions