As I understand OSRM finds fastest possible routes. Will shortest (dependant only on length of edges) be implemented as an option?
blackstarr [email protected] writes:
As I understand OSRM finds fastest possible routes. Will shortest
(dependant only on length of edges) be implemented as an option?
you can use a profile where speed is constant (regardless of way
attributes)
=> then you get shortest
did that, but i'd like to get real travel time also...
due to changes in speedprofiles that's impossible
i think shortest path would be a useful option.
in the branch feature/lua_weights, you can set a weight on each way, separate from the speed. this almost accomplishes what you want, expect that speed and weight are multiplied. you could modify it to only use weight when picking the route, and use a constant weight for all ways.
https://github.com/DennisOSRM/Project-OSRM/tree/feature/lua_weights
Right now there is only a single weight function. The distances are computed on the fly when the route description is generated. This does not work the other way around, unfortunately.
Am 16.11.2012 um 14:13 schrieb Emil Tin [email protected]:
i think shortest path would be a useful option.
in the branch feature/lua_weights, you can set a weight on each way, separate from the speed. this almost accomplishes what you want, expect that speed and weight are multiplied. you could modify it to only use weight when picking the route, and use a constant weight for all ways.
https://github.com/DennisOSRM/Project-OSRM/tree/feature/lua_weights
—
Reply to this email directly or view it on GitHub.
When #77 lands, this will be doable. Closing and tracking over there.
Hi, I am working with fastest service OSRM and want to make shortest service. I'd like change all speed to same value. But when I compare result 2 services, the distance of fastest service still lower than the distance of shortest service. I'd like to need help how to set up car.lua.
Thanks
@nqlong what did you change so far?
@danpat I change all value in speeds variable to default speed (10) and properties.weight_name = 'distance'
speeds = Sequence {
highway = {
motorway = 90,
motorway_link = 45,
trunk = 85,
trunk_link = 40,
primary = 65,
primary_link = 30,
secondary = 55,
secondary_link = 25,
tertiary = 40,
tertiary_link = 20,
unclassified = 25,
residential = 25,
living_street = 10,
service = 15
}
},
speeds = Sequence {
highway = {
motorway = 10,
motorway_link = 10,
trunk = 10,
trunk_link = 10,
primary = 10,
primary_link = 10,
secondary = 10,
secondary_link = 10,
tertiary = 10,
tertiary_link = 10,
unclassified = 10,
residential = 10,
living_street = 10,
service = 10
}
},
@nqlong Actually, we have a shortcut with OSRM 5.6.
You can set:
properties.weight_name = "distance"
here: https://github.com/Project-OSRM/osrm-backend/blob/e96545be2ebebee67791dff9afaed1c6f05462b2/profiles/car.lua#L25)
and you should get "route-by-distance" results. You should also comment out traffic-light handling, because this adds a time delay that you don't want for distance routing: https://github.com/Project-OSRM/osrm-backend/blob/e96545be2ebebee67791dff9afaed1c6f05462b2/profiles/car.lua#L298-L302
This should give you "route by shortest distance, return reasonable durations"-style routing.
@nqlong @danpat distance weight was not really tested and there is an incorrect fallback to zero weight, so rates are not used
i will provide a fix soon. is it a candidate for 5.7?
@oxidase nah, I don't think it's super-urgent. If you make the fix, we can talk about backporting it for 5.7.1 next week sometime.
@danpat @oxidase : I have changed as @danpat said. And when I request
route/v1/driving/-0.177749,51.601100;-0.3602569,51.4036816
The result of shortest is
"legs": [
{
"steps": [],
"distance": 35941,
"duration": 3856,
"summary": "",
"weight": 75.2
}
The result of fastest is
"legs": [
{
"steps": [],
"distance": 32013.8,
"duration": 2560.4,
"summary": "",
"weight": 2560.4
}
The distance of fastest still lower than the shortest service. Any ideas about this ? Thanks
@nqlong You should take a look at the debug map to see if road speeds are being assigned properly.
Get a copy of https://github.com/Project-OSRM/osrm-frontend, set it up, and use the /debug/ URL to view the internal routing map of OSRM. See if any roads with different speeds stand out, or if you've somehow got different roads available on the two different endpoints.
There may be some complications around avoiding service roads/alleys and turn costs that are causing problems - the distance option has not been highly tested, so it may contain bugs.
Also, make sure you've got the latest master code that includes the https://github.com/Project-OSRM/osrm-backend/issues/3956 PR that @oxidase added yesterday.
Most helpful comment
did that, but i'd like to get real travel time also...
due to changes in speedprofiles that's impossible