Surface is already taken into account for bicycles in the OSRM main repo:

https://github.com/DennisOSRM/Project-OSRM/blob/master/profiles/bicycle.lua

However, instead of multiplying, I found it more realistic to simply use the 
surface speed, instead of multiplying:

surface_speeds = {
        ["asphalt"] = default_speed,
        ["cobblestone:flattened"] = 10,
        ["paving_stones"] = 10,
        ["compacted"] = 10,
        ["cobblestone"] = 6,
        ["unpaved"] = 6,
        ["fine_gravel"] = 6,
        ["gravel"] = 6,
        ["fine_gravel"] = 6,
        ["pebbelstone"] = 6,
        ["ground"] = 6,
        ["dirt"] = 6,
        ["earth"] = 6,
        ["grass"] = 6,
        ["mud"] = 3,
        ["sand"] = 3
}

        
    -- surfaces
    if surface then
        surface_speed = surface_speeds[surface]
        if surface_speed then
            if way.speed > 0 then
                way.speed = surface_speed
            end
            if way.backward_speed > 0 then
              way.backward_speed  = surface_speed
            end
        end
    end

Both approaches might have merit.



Kind regards,

Emil Tin
IT- and Process Specialist
Traffic Design
________________________________
CITY OF COPENHAGEN
The Technical and Environmental Administration
Traffic Department

Islands Brygge 37 Vær. 118
Postboks 450
2300 København S

Telefon +45 2369 5986
Email z...@tmf.kk.dk
EAN 5798009493149


-----Oprindelig meddelelse-----
Fra: Hans Gregers Petersen [mailto:greg...@septima.dk] 
Sendt: 28. februar 2014 09:16
Til: osrm-talk@openstreetmap.org
Emne: Re: [OSRM-talk] Beginner question: default car profile and 
tracktype/smoothness/surface

Hi Fernando,

> I've always wondered if there are any plans taking surface 
> type/quality into account in the default profiles. I live in a 
> developing country (Brazil) with poorly maintained roads and these 
> conditions make a big difference at the beginning and at the end of 
> many routes if ignored.

I do not know about the plans regarding the default profile, but I successfully 
used a simple "factor approach" to surfaces when doing our routing on bicycle 
paths here in Denmark.
For instance setting the following in the LUA profile:

-- How much does speed depreciate by surface surface_factors = { ["unpaved"] = 
0.8, ["gravel"] = 0.8, ["cobblestone"] = 0.8, ["dirt"] = 0.8, ["earth"] = 0.8, 
["sand"] = 0.8, ["cobblestone:flattened"] = 0.9, ["compacted"] = 0.9, 
["fine_gravel"] = 0.9, ["wood"] = 0.9 }

and then later adjuste the speed accordingly:

-- Surface tag
local surfacetag = way.tags:Find("surface")

-- Surface factor
if surface_factors[surfacetag] then
way.speed = way.speed * surface_factors[surfacetag] way.backward_speed = 
way.backward_speed * surface_factors[surfacetag] end



Best regards,

Greg



Hans Gregers Petersen
Partner, Senior Consultant
www.septima.dk

_______________________________________________
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk

_______________________________________________
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk

Reply via email to