Open leadq opened 6 years ago
@emregurler for a local extract of turkey-latest.osm.pbf
with timestamp 2017-11-14T21:44:02Z i got
curl -s 'localhost:5000/table/v1/driving/29.057621,40.993861;29.291485,40.915575;29.305764,40.93005303' | jq
{
"code": "Ok",
"durations": [
[
0,
1417.8,
1463.3
],
[
1474.2,
0,
251.1
],
[
1555.5,
281.5,
0
]
],
"destinations": [
{
"hint": "o2gKgGlpCoAXAAAAKQAAAAAAAACIAAAAFwAAACkAAAAAAAAAiAAAAE0CAACJYrsBPIRxAlViuwFFhHECAAAfDDYYvkk=",
"name": "",
"location": [
29.057673,
40.993852
]
},
{
"hint": "6bsLgDO8C4BUAAAANQAAAAAAAAAAAAAAVAAAADUAAAAAAAAAAAAAAE0CAAAu9L4B01JwAt3zvgF3UnACAAD_EjYYvkk=",
"name": "",
"location": [
29.291566,
40.915667
]
},
{
"hint": "KRBDgP___38iAAAAdwAAAB0AAAALAAAAIgAAAHcAAAAdAAAACwAAAE0CAAC0Kr8BlIpwAqQrvwEFi3ACAQB_FDYYvkk=",
"name": "",
"location": [
29.305524,
40.92994
]
}
],
"sources": [
{
"hint": "o2gKgGlpCoAXAAAAKQAAAAAAAACIAAAAFwAAACkAAAAAAAAAiAAAAE0CAACJYrsBPIRxAlViuwFFhHECAAAfDDYYvkk=",
"name": "",
"location": [
29.057673,
40.993852
]
},
{
"hint": "6bsLgDO8C4BUAAAANQAAAAAAAAAAAAAAVAAAADUAAAAAAAAAAAAAAE0CAAAu9L4B01JwAt3zvgF3UnACAAD_EjYYvkk=",
"name": "",
"location": [
29.291566,
40.915667
]
},
{
"hint": "KRBDgP___38iAAAAdwAAAB0AAAALAAAAIgAAAHcAAAAdAAAACwAAAE0CAAC0Kr8BlIpwAqQrvwEFi3ACAQB_FDYYvkk=",
"name": "",
"location": [
29.305524,
40.92994
]
}
]
}
and
curl -s 'localhost:5000/trip/v1/driving/29.057621,40.993861;29.291485,40.915575;29.305764,40.93005303' | jq
{
"code": "Ok",
"trips": [
{
"geometry": "qreyFmijpDsKmHpJaV|Iks@vKeHkA}`@d]ydAt_@{^wO{n@sx@sfA{Qek@kHiuAfMycBt@ogAdWkdBvDmkAxd@ydAvLkqAd[iiAzFmqBhTw_ApH{x@zKu^lg@gw@lkA_jDvvAk{Cl]pNfa@n}Aw@rKiJhGvF`JiUpQgGbDg@aJtg@ca@tMjRv\\vHzDhPfKdGbKrc@uO~b@tQu`@}BgFjEuAbWhZvOlp@rFrs@rG`TxWrVbDlj@oHrn@zQ~LrUt`AbY`^asBn}DqmBv{I}iFzwGsjBndAwZ~[_t@ptBaD}@bb@iCdJ|G~A|MwSzd@eLfi@iNiC",
"legs": [
{
"steps": [],
"distance": 29666.1,
"duration": 1463.3,
"summary": "",
"weight": 1463.3
},
{
"steps": [],
"distance": 3760.2,
"duration": 281.5,
"summary": "",
"weight": 281.5
},
{
"steps": [],
"distance": 28498.1,
"duration": 1474.2,
"summary": "",
"weight": 1474.2
}
],
"distance": 61924.4,
"duration": 3219,
"weight_name": "routability",
"weight": 3219
}
],
"waypoints": [
{
"waypoint_index": 0,
"location": [
29.057673,
40.993852
],
"name": "",
"hint": "o2gKgGlpCoAXAAAAKQAAAAAAAACIAAAAFwAAACkAAAAAAAAAiAAAAE0CAACJYrsBPIRxAlViuwFFhHECAAAfDDYYvkk=",
"trips_index": 0
},
{
"waypoint_index": 2,
"location": [
29.291566,
40.915667
],
"name": "",
"hint": "6bsLgDO8C4BUAAAANQAAAAAAAAAAAAAAVAAAADUAAAAAAAAAAAAAAE0CAAAu9L4B01JwAt3zvgF3UnACAAD_EjYYvkk=",
"trips_index": 0
},
{
"waypoint_index": 1,
"location": [
29.305524,
40.92994
],
"name": "",
"hint": "KRBDgP___38iAAAAdwAAAB0AAAALAAAAIgAAAHcAAAAdAAAACwAAAE0CAAC0Kr8BlIpwAqQrvwEFi3ACAQB_FDYYvkk=",
"trips_index": 0
}
]
}
The durations table is
from | to 0 | to 1 | to 2 |
---|---|---|---|
0 | 0 | 1417.8 | 1463.3 |
1 | 1474.2 | 0 | 251.1 |
2 | 1555.5 | 281.5 | 0 |
Let trip starts at the point 0. So only two trips are possible:
0->1->2->0
with duration 1417.8+251.1+1555.5=3224.4 seconds
0->2->1->0
with duration 1463.3+281.5+1474.2=3219 seconds
The seconds trip is the optimal one and returned by the plugin.
The durations matrix entries can be computed also as point-to-point routes, for example the upper part of the matrix is
curl -s 'localhost:5000/route/v1/driving/29.057621,40.993861;29.291485,40.915575' | jq .routes[].duration
1417.8
curl -s 'localhost:5000/route/v1/driving/29.057621,40.993861;29.305764,40.93005303' | jq .routes[].duration
1463.3
curl -s 'localhost:5000/route/v1/driving/29.291485,40.915575;29.305764,40.93005303' | jq .routes[].duration
251.1
Thanks for your reply oxidase. I know I got same result with you. I am emphasizing that OSM website computes 0->2 is shorter than 0->1 in both duration and distance, and also OSRM trip service result is same. I tried point to point on website. However, OSRM table service computes 0->1 is shorter than 0->2. I still don't understand why.
I got this from openstreetmap.com: from 0 to 1 = 33km and 39mins from 0 to 2 = 32km and 35mins, so result in duration matrix is wrong I guess.
@emregurler sorry for confusion. https://www.openstreetmap.org/directions shows results of the OSRM demo backend server http://router.project-osrm.org/ that uses traffic data from Mapbox, so durations are larger because freeflow speed values from OSM tags are too optimistic in comparison to speed values taken from traffic data.
For both https://www.openstreetmap.org/directions?engine=osrm_car&route=40.9931%2C29.0574%3B40.9142%2C29.2935 and https://www.openstreetmap.org/directions?engine=osrm_car&route=40.9931%2C29.0574%3B40.9295%2C29.3059#map=12/40.9675/29.1896
router.project-osrm.org returns
echo $(echo "scale=2; $(curl -s 'http://router.project-osrm.org/route/v1/driving/29.057621,40.993861;29.291485,40.915575' | jq .routes[].duration) / 60." | bc)
39.02
echo $(echo "scale=2; $(curl -s 'http://router.project-osrm.org/route/v1/driving/29.057621,40.993861;29.305764,40.93005303' | jq .routes[].duration) / 60." | bc)
35.15
minutes instead of 23.63 and 24.38 minutes using free flow speed values, respectively.
Are you saying that there is nothing wrong and If I use traffic data, I will get same result with OSM? By the way, could you explain what is difference between weight = routability and other 2 option(distance and duration)?
@emregurler if you use router.project-osrm.org
you will get modified durations that may change in time. eg, atm results of the same requests as in the previous comment are different:
echo $(echo "scale=2; $(curl -s 'http://router.project-osrm.org/route/v1/driving/29.057621,40.993861;29.291485,40.915575' | jq .routes[].duration) / 60." | bc)
38.98
echo $(echo "scale=2; $(curl -s 'http://router.project-osrm.org/route/v1/driving/29.057621,40.993861;29.305764,40.93005303' | jq .routes[].duration) / 60." | bc)
34.99
If you need results based on OSM tags only, you have to run own pipeline.
By the way, could you explain what is difference between weight = routability and other 2 option(distance and duration)?
weight="distance"
the shortest path will be returnedweight="duration"
the fastest path will be returnedweight="routability"
the fastest path will be returned with additional penalization of turns to restricted areas https://github.com/Project-OSRM/osrm-backend/blob/28b89f6697692a0890ea302b261ef2100af226e4/profiles/car.lua#L443-L446 The additional penalty is about 54 minutes so detours around restricted areas faster than 54 minutes will be preferred over transit routes.
weight="distance" the shortest path will be returned weight="duration" the fastest path will be returned weight="routability" the fastest path will be returned with additional penalization of turns to restricted areas
Thanks for information. So, can we say that distance and duration arrays' order will be same? Because duration is in direct proportion to distance. If there is no penalty, the orders of arrays doesn't not change I guess, does it? I can not use router.project-osrm.org because I sometimes need big duration matrix, but it has limitation like 500-1000 points.
can we say that distance and duration arrays' order will be same? Because duration is in direct proportion to distance. If there is no penalty, the orders of arrays doesn't not change I guess, does it?
path durations without turn penalties are sum(segment_length[i] / speed[i])
for all i
path segments and path distances are sum(segment_length[i])
, so duration i values are not in direct proportion to distance.
It is true only if speed values are constant and do not depend on segment index i
.
can we say that distance and duration arrays' order will be same? Because duration is in direct proportion to distance. If there is no penalty, the orders of arrays doesn't not change I guess, does it?
path durations without turn penalties are
sum(segment_length[i] / speed[i])
for alli
path segments and path distances aresum(segment_length[i])
, so duration i values are not in direct proportion to distance. It is true only if speed values are constant and do not depend on segment indexi
.
hi, as you said distance will return the shortest path and (sum(segment_length[i])) it won't consider the segments speeds, but when i change speed of segments in my local osrm in segments speed csv file, the returned route will change, and this result shows me that osrm in distance mode will look at segments speed, am i right or not?
This issue seems to be stale. It will be closed in 30 days if no further activity occurs.
Hello, I have some calculations with duration matrix in my project. I am analyzing durations between "depot" and other 2 locations.I found something wrong between two results. Here is my requests with weight = routability in car.lua and version is latest. First :
table/v1/driving/29.057621,40.993861;29.291485,40.915575;29.305764,40.93005303
and it returned me that index0 to index2 is further than index0 to index1. Secondly I used trip service for crosschecking:trip/v1/driving/29.057621,40.993861;29.291485,40.915575;29.305764,40.93005303
However, it shows me that the route between these 3 locations with starting index0 is like 0-2-1. After this result, I have doubt about it and I checked directions between 0-1 and 0-2 separately on https://www.openstreetmap.org, and it calculated as same as trip service: from index0 to index1 is further that index0 to index2. Could you please check this service results? Maybe I missed something and got results wrong. Thanks. Note: all locations are in Turkey.