Config file, custom model, ignore traffic rule

Hi, is it possible to ignore oneway ( vehicle:forward ? ) in the config file for custom model?

No, currently not, because vehicle:forward is condensed in car_access along with other tags that determine car_access. You would have to create your own encoded value to distinguish this.

Hi Easbar, thank you, I was hoping to ignore directions by allowing all,

        priority: [
            "if": "car_access == false",
            "multiply_by": "1"

Can all in code also be configured through the config file/ custom model?

What is your use case?

You can have a look into the custom model of bike: graphhopper/core/src/main/resources/com/graphhopper/custom_models/bike.json at 9.x · graphhopper/graphhopper · GitHub

For this case we use bike_access with backward_bike_access in combination so that we allow reverse access of oneways. And if it goes in reverse direction we limit it to walking speed and additionally give it a higher penalty (multiply_by 0.2)

Roads with car_access == false aren’t accessible and you cannot change this by multiplying the priority by one like you suggested (the priority is zero so cannot be changed by multiplication). However, this is only true up to GraphHopper version 8. With GraphHopper 9 (that we released today) the usage of car_access is no longer implicit and roads will be open unless you explicitly close them using a statement with car_access. So with version 9 it should be easy to route on roads for which car_access==false by just using the config file. However, this still does not allow you to distinguish roads for which car_access is false due to the vehicle:forward tag and roads for which car_access is false because of some other tag. This would require changes in the Java code.

Hi @karussell, basically I want to route car traffic through custom model without traffic rules ( so without respecting the directions of the traffic in the OSM )

@easbar I will try out version 9! For changing code, I need to implement my own version of CarAccessParser?

restrictions → should be vehicle_types

    vehicle_types: [ motorcar, motor_vehicle ]
    u_turn_costs: 60

@easbar I tested with version 9 but still it is not possible to route in the wrong direction ?


  graph.encoded_values: car_access|block_private=false, road_class, road_class_link, road_environment, max_speed, road_access, car_temporal_access, car_average_speed, foot_access, foot_priority, foot_average_speed, bike_priority, bike_access, roundabout, bike_average_speed
  graph.bytes_for_flags: 8

    - name: unrestrained
      weighting: custom
      speed_two_directions: false
      block_barriers: false
      custom_model: {
        speed: [
          { if: "true", limit_to: "car_average_speed" }

Are the roads open in GH9 ? I wish to route against traffic, not follow the rules. I rather do this through the custom model than java code. If it is possible let me know, kinds regards Peter

I just tested this myself and with GH 9 and your configuration the roads should already be open in both directions. You can remove the lines with speed_two_directions and block_barriers, they won’t do anything. Also graph.bytes_for_flags is unnecessary. After changing the configuration file of course you need to delete the “*-gh” (or “graph-cache”) folder and run a new import.

1 Like