Profile not working for great britain
Closed this issue · 3 comments
Hi!
Thanks for thoses greats profiles! It really helped me a lot!
They work very fine for all continental europe, but when it comes to great britain, it seems very unstable.
For example, if I generate my osrm map with this profile (freight.lua), from the european-latest.osm.pbf (That I've filtered with osmium nw/railway), osrm is unable to compute some basics route.
Example, a route between : [-0.160675,51.187951],[-0.168915,51.220432]
(It doesn't go on the good coordinates, the road begin very far from it)
I tried to change the restriction, but nothing has effect on it.
Would you have an idea ?
Hi kushia !
I never tried the profile in the UK. At the moment, the profile filters out gauges that are not 1435 mm, could it be that the zone you are working on is using another gauge ?
If not, could you take a look at the debug map ? It could help to see if it's a filtering or connectivity problem.
You could also try with the basic.lua
profile to see if it changes anything.
Hi C4ptainCrunch!
I made a lot of tests, and it appears that it was because of the variable "data.maxspeed".
It seems than for the ways in UK, data.maxspeed returns sometimes a string like this "X mph" instead of an integer.
So, the script was failing for the way who was evaluating, and the way was then ignored. (osrm-extract doesn't throw an error for those cases and then pass to the next way to evaluate I guess)
You can correct it like that :
speed = tostring(speed)
speed = speed:gsub(" mph", "")
speed = speed:gsub("mph", "")
speed = tonumber (speed)
Before :
result.forward_speed = speed
result.backward_speed = speed
And of course, it should be converted to the proper metric for those who are in mph
I tested the proposed patch and it works well for UK and the rest of Europe.
-- fix speed for mph issue
speed = tostring(speed)
if speed:find(" mph") or speed:find("mph") then
speed = speed:gsub(" mph", "")
speed = speed:gsub("mph", "")
speed = tonumber (speed)
if speed == nil then speed = 20 end
speed = speed * 1.609344
else
speed = tonumber (speed)
end
-- fix speed for mph issue end