Marius Popa
Marius Popa

Reputation: 33

How does OSRM compute the duration

I'm trying to understand why there is a difference between the total duration computed by OSRM and the sum of the following - routes->legs->annotation->duration.

The request that I'm using is the following:

https://router.project-osrm.org/route/v1/car/11.533996006963445,48.16530925;11.558144983073191,48.140675599999994?overview=full&geometries=polyline&steps=true&annotations=true

If I sum-up the routes->legs->annotation->duration I got 449 seconds. But the total time computed by the OSRM - routes->duration is equals to 508.9, which is equal to sum legs->steps->duration.

Upvotes: 0

Views: 1280

Answers (1)

Arslan
Arslan

Reputation: 36

I think you are summing up wrong attribute. You should sum up route -> legs -> steps. If you sum them up, then it is correct. Furthermore, you also get the shape of each leg using route -> legs -> steps -> geometry. You can test it again on a simpler request as following: http://router.project-osrm.org/route/v1/car/11.533996006963445,48.16530925;11.532000,48.162711?overview=full&geometries=polyline&steps=true&annotations=true

I am not sure of the actual usage of annotations. But definitely for your purpose steps should suffice.

Upvotes: 1

Related Questions