GIScience / openrouteservice

🌍 The open source route planner api with plenty of features.
https://openrouteservice.org
GNU General Public License v3.0
1.43k stars 392 forks source link

Error "A time-dependent routing algorithm requires a time-dependent weighting" #1856

Open TommasoDb opened 3 days ago

TommasoDb commented 3 days ago

Is there an existing issue for this?

Where did you encounter this issue?

self-hosted instance

Request URL

http://localhost:8082/ors/v2/directions/driving-car

POST Request Body

{
    "departure":"2024-10-01T15:08",
    "coordinates": [
        [
            8.62358093261719,
            49.400585132197136
        ],
        [
            8.675422,
            49.403474
        ]
    ],
    "elevation": true,
    "instructions_format": "html",
    "extra_info": [
        "surface",
        "steepness",
        "waytype"
    ],
    "language": "en",
    "units": "km",
    "preference": "recommended",
    "options": {
        "avoid_polygons": {
            "type": "MultiPolygon",
            "coordinates": [
                [
                    [
                        [
                            8.653708,
                            49.398574
                        ],
                        [
                            8.653708,
                            49.405444
                        ],
                        [
                            8.65448,
                            49.405444
                        ],
                        [
                            8.65448,
                            49.398574
                        ],
                        [
                            8.653708,
                            49.398574
                        ]
                    ]
                ]
            ]
        }
    }
}

Response

Response ```JSON { "error": { "code": 2099, "message": "Unable to compute a route" }, "info": { "engine": { "build_date": "2024-09-13T08:01:06Z", "version": "8.1.3" }, "timestamp": 1727854356190 } } ```

Current behavior

Computation of a route is not possible using the parameters departure and avoid_polygons in the same request. The server returns a 500 error and the error message.

ors-app  | 2024-10-02 07:32:36 ERROR                                 http-nio-8080-exec-2 [ o.h.o.r.RoutingRequest                   ]   java.lang.RuntimeException: A time-dependent routing algorithm requires a time-dependent weighting.

The server runs all default params (config and data), as described in the README https://github.com/GIScience/openrouteservice/?tab=readme-ov-file#installation. No changes has been made to the default installation.

The route works as expect when the avoid_polygons part is removed from the request.

Expected behavior

The server should return the correct route with respect of the avoid polygon.

Openrouteservice Version

8.1.3

Build date

2024-09-13T08:01:06Z

Graph date

2024-10-01T06:51:35Z

Forum Topic Link

https://ask.openrouteservice.org/t/error-when-using-avoid-zones-a-time-dependent-routing-algorithm-requires-a-time-dependent-weighting/6532/2

aoles commented 3 days ago

Thanks for reporting this!

To better understand the problem and your use-case, could you maybe clarify the reason why you specify departure in the request?

Cheers!

TommasoDb commented 3 days ago

We want to use statistical routing.

At the moment we use both: statistical and non statistical routing. In both cases we want to be able to use start/end times and send the same request against ORS. This still worked in 6.6 and 7.1.

I noticed that departure is not documented in the API: https://openrouteservice.org/dev/#/api-docs/v2/directions/{profile}/json/post

but is supported in 6 and 7, and it has a effect - even without statistical routing - , making the fields departure and arrival appearing in the response.

Param arrival has the same effect.