A main component that determines things such as fastest routes and the travel time for isochrones and route instructions is travel speed. This value is determined differently depending on the profile and can be affected by a number of aspects.
The travel time is calculated for each segment by using speed-limits for different waytypes and adjusting them for different grades or surfaces of the road. If multiple values apply at any point, the lowest value is used.
The base travel speed for any road is based on a cascading assessment:
- When an tag explicitly stating the speed limit for a road is present on the way in OSM (
maxspeed:forward / maxspeed:backward), this is used as the base speed.
- If the way has a
zone:traffictag, this is compared to country-specific values in the
max_speedsarray of the speed value files. An overview can be found in the country speed table. This value is then used as the base speed.
- If neither of the above set a base speed, then the type of way (
highway=tag) determines the base speed. Values are defined in the speed value files. The waytype speed table gives an overview.
- If it is a track (
highway=track) then the base speed is set based on the
tracktypetag compared to values in the speed value files. The tracktype speed table gives an overview.
If the determined base speed is one resulting from a
maxspeed-tag or from a country speed table (i.e. Steps 1 or 2), it is reduced to 90% of its original value, since it is more common that you would be travelling below the maximum speed value. The waytype and tracktype defaults have already been chosen rather conservatively, so they are not adjusted.
Following that, it is further modified based on a number of other factors:
- If a surface is defined (
surface=*) then the surface value is set to be the corresponding surface type value defined in the speed value files. An overview can be found in the surface speed table.
- Attempt to take into account reduced speeds in residential areas using acceleration modifier or a residential penalty
- cap speed if it is entering a roundabout (based on number of lanes and roundabout type - mini roundabout = 25km/h, 1 lane = 35km/h, 2 or more lanes = 40km/h)
Bike profiles determine their speeds based on a number of defaults set in the code based on surface, highway type, and track type. Though there is currently a speed_limits file present in the resources for bike profiles, these values are not used in the calculation
The speeds used can be found in the CommonBikeFlagEncoder for the default values and regular bike profile, MountainBikeFlagEncoder for the mountain bike profile, RoadBikeFlagEncoder for the road bike, and ElectroBikeFlagEncoder for the electric bike.
Note that each bike profile has a different value set for the maximum downhill speed which is calculated when
consider_elevation=true is set in the ors-config.json. Currently, this option is turned off for openrouteservice live servers as it can lead to undesirable routes.
The travel speeds for
foot-* profiles (walking and hiking) are set to 5 km/h on all allowed waytypes. For ways with a
sac_scale higher than
hiking, they are reduced to 2 km/h.
Allowed waytypes consist of ways that are safe for use, ways that are better avoided (but still allowed) and other allowed ways in between:
|safe tags||avoid tags||other highway tags|
The wheelchair profile has a base speed of 4km/h which is then modified based on a number of parameters. As such, based on the presence of sidewalks and type of way, the actual speed can range from 3 to 10km/h