Directions timeout request

Hi

I send request below, but I receive timeout in response. I’m going something wrong ?

{
    "points": [
        [
            -48.504499673318215,
            -1.4559962932769313
        ],
        [
            -46.636740680587764,
            -23.547386273407625
        ],
        [
            -43.526897287710206,
            -4.815052774526026
        ],
        [
            -44.655435,
            -4.297795
        ],
        [
            -43.526897287710206,
            -4.815052774526026
        ],
        [
            -46.636740680587764,
            -23.547386273407625
        ],
        [
            -48.504499673318215,
            -1.4559962932769313
        ],
        [
            -46.636740680587764,
            -23.547386273407625
        ],
        [
            -43.526897287710206,
            -4.815052774526026
        ],
        [
            -44.655435,
            -4.297795
        ],
        [
            -43.526897287710206,
            -4.815052774526026
        ],
        [
            -46.636740680587764,
            -23.547386273407625
        ],
        [
            -48.504499673318215,
            -1.4559962932769313
        ]
    ],
    "details": [
        "average_speed"
    ],
    "locale": "pt_BR",
    "points_encoded": true,
    "instructions": true,
    "calc_points": true,
    "elevation": false,
    "optimize": "false",
    "custom_model": {
        "distance_influence": 15.0,
        "heading_penalty": 300.0,
        "internal": false,
        "areas": {},
        "priority": [],
        "speed": []
    },
    "ch.disable": true,
    "vehicle": "truck"
}

Thanks

The custom_model parameter requires a different more flexible algorithm (ch.disable=true) leading to a more intensive route calculation especially for long distance routes like this one here (>20 000 km). If you remove the custom_model and ch.disable parameter it will succeed.

(btw: note that you should replace the vehicle with the profile parameter)

Thank you for the explanation.

I identified the points cause timeout, but route it’s not very big.

What’s route distance not cause timeout ?


{
    "points": [
        [
            -43.526897287710206,
            -4.815052774526026
        ],
        [
            -46.636740680587764,
            -23.547386273407625
        ]
    ],
    "details": [
        "average_speed"
    ],
    "locale": "pt_BR",
    "points_encoded": true,
    "instructions": true,
    "calc_points": true,
    "elevation": false,
    "optimize": "false",
    "custom_model": {
        "distance_influence": 15.0,
        "heading_penalty": 300.0,
        "internal": false,
        "areas": {},
        "priority": [],
        "speed": []
    },
    "ch.disable": true,
    "vehicle": "truck"
}

It is still a route too long for this algorithm. Why would you need the custom model feature when you use the default values?

Because in this case, I need to separate between “the fastest” and “the shortest”. Previously the API had this parameter clearly.

It wasn’t possible before either because weighting=shortest used the more flexible algorithm too.

I can still suggest a good solution to your problem with the following request:

{
    "points": [
        [
            -43.526897287710206,
            -4.815052774526026
        ],
        [
            -46.636740680587764,
            -23.547386273407625
        ]
    ],
    "algorithm":"alternative_route",
    "profile": "truck"
}

You’ll get back 3 alternative routes and then you can select the shortest and the fastest. Please note that these request cost 2 credits instead of 1.

Would this work?

Was something changed ? I made the request now and it work.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.