Routing Api responds with 400 or 500 with custom_model

Steps to reproduce:

  1. Create route with more than 15-20 points. (overall length of the route would be more than 2500km)
  2. Send POST request to the Routing API with custom_model:
ch.disable: true,
 custom_model: {
    priority: [
      {
        if: "country == CHE",
        multiply_by: "0",
      },
    ],
  }

Whenever there is more than 700km between two points or we are setting two points that are separated by restricted country I will get:

  1. Status code 500. Message: “timeout”
  2. Status code 400. Message: “Connection between locations not found”

As far as I read, the problem is that ch.disable: true disables the speed mode (Contraction Hierarchy) and calculating points that are more than 500-700km apart is too complex for other algorithm.

Are there ways to use Contraction Hierarchy with restricted countries/areas?

Unfortunately this is currently a known limitation that the more the resulting route deviates from the route without the custom model you’ll increase the chance to get a timeout.

If you are using the open source routing engine you can add the profile using this custom model to the profiles_ch section of the config and you can solve this problem easily but it will take more memory and a longer preparation time.

Or you speed up the flexible routing request with excluding certain ways via e.g.

{ "if": "road_class == TRACK || road_class == RESIDENTIAL", "multiply_by": "0" }

or increasing the heuristic via the “epsilon trick”.