Custom profile car_delivery

I need to configure routing for the estimation of delivery cost. Usually the default car profile works well but there are a few troublesome corner cases.

As a specific example, the city center of Olomouc has OSM tags vehicle = yes and vehicle:conditional = delivery @ (12:00-14:00); delivery+psv @ (18:00-10:00). I’d like to configure a car profile allowed to go through but my effort has no effect. Actually, there is no way to allow access, I can only forbid it by setting priority to zero.

There is no routing profile for delivery cars in the default configuration and I was not able to find the car_delivery configuration anywhere, it’s included only in the paid plans of Graphhopper.

My current thoughts (please confirm if I’m right):

  1. Maybe these conditional tags are too difficult to allow anything?
  2. Perhaps config file cannot allow access and I have to set this up in java code?
  3. Does the road_access == DELIVERY depend on tag delivery = yes which is almost never used?

Time dependent routing is possible but not in master.

But if you just want to include these roads (like it is done in the GraphHopper Directions API) you could either use the roads vehicle and configure your own car:

graph.flag_encoders: car,roads
profiles:
  profile: car_delivery
  vehicle: roads
  weighting: custom
  custom_model:
    speed:
     - if: "car_access"
       limit_to: "car_average_speed"
     - else: ""
       limit_to: "5"
    priority:
     - if: "road_access == DELIVERY || road_access == PRIVATE"
       multiply_by: "1"
     - else_if: "car_access == false"
       multiply_by: "0"

Or you use the older (and soon deprecated) graph.flag_encoders (graph.vehicles) configuration:

graph.flag_encoders: car|block_delivery=false|block_private=false

but my effort has no effect.

The problem in this case is also the pedestrian road which is excluded for cars. To make it work you could also use the roads vehicle and allow pedestrian roads (but this is very tricky and not recommended!):

GH Maps link

As we also support conditions with an area, you could make use of it and only allow pedestrian roads for this area…

Thanks, that seems to work!

It’s a nice trick that the roads vehicle is also supported on GH maps, so that I can test it quickly.

Anyway, I’m still facing issues. These pedestrian roads are actually allowed for delivery vehicles, some for a few hours, some of them all day long (motor_vehicle:conditional = delivery+psv @ (00:00-24:00)). I see that the routing should not depend on day time, but still – is it possible to use these OSM flags for conditional access in case they are 00-24?

edit: link to OSM way @ (00-24)
Thinking about it again, I guess I’ll have to actually fix this in OSM because these flags make little sense.

edit2: I edited the tags in the city of Olomouc and thus, hopefully, resolved my issue.