osrm-backend/profiles
Matt Riggott f7478ba80f
Process maxspeed tag before surface, smoothness, and tracktype tags (#6002)
* Handle maxspeed tags before surface and smoothness tags

Let's say we have a tertiary road with the following tags:

   highway=tertiary
   maxspeed=60
   surface=gravel
   smoothness=intermediate

While the maxspeed tag tells us the legal speed limit, the surface and
smoothness tags have much more effect on the real-world speed of a car.
We should process the maxspeed tags first, and then update the road's
forwards/backwards speeds according to any surface and smoothness tags.
For our hypothetical road the process in the car.lua profile now goes
like this:

1. Get default speed from profile (tertiary = 40 on line 150 of car.lua)
2. Change speed to 60 using maxspeed tag (WayHandlers.maxspeed function
   in way_handlers.lua, lines 434-447)
3. Change speed to 40 using surface tag (WayHandlers.surface function
   in way_handlers.lua, lines 360-363)
4. Check speed according to smoothness tag --- but because it's higher
   than the speed according to the surface tag, leave the speed
   unchanged (WayHandlers.surface function again, lines 368-371)

<ec36319232/profiles/car.lua (L150)>
<ec36319232/profiles/lib/way_handlers.lua (L354-L372)>

Note in step 3 above the speed's only changed from 60kph to 40kph
because it's a lower value. If the surface speed was higher than than
the previous value, the speed would remain unchanged. Another example:

   highway=tertiary
   maxspeed=60
   surface=compacted
   smoothness=intermediate

Here, although the profile's speed for compacted is 80, it would stay at
the lower value of 60 (see way_handlers.lua, lines 360-363).

<ec36319232/profiles/lib/way_handlers.lua (L360-L363)>
2021-06-03 17:56:57 +01:00
..
examples Allow specifing a weight for routing that is independent of duration 2017-01-27 11:19:37 +01:00
lib Merge pull request #5908 from systemed/debug_way 2020-12-21 20:14:37 +02:00
bicycle.lua Bicycle: treat use_sidepath as no access 2019-12-01 18:34:58 +01:00
car.lua Process maxspeed tag before surface, smoothness, and tracktype tags (#6002) 2021-06-03 17:56:57 +01:00
debug_example.lua Fix profiles/debug_example.lua cannot interprete by lua 2020-04-09 16:05:37 +07:00
debug_way.lua Update comments 2020-12-15 12:49:52 +00:00
foot.lua change barrier_whitelist to barrier blacklist 2018-05-29 16:56:15 +02:00
rasterbot.lua profiles api v2 2017-07-18 10:09:22 +00:00
rasterbotinterp.lua profiles api v2 2017-07-18 10:09:22 +00:00
test.lua Fix broken path in documentation (#5636) 2020-08-10 08:50:15 -07:00
testbot.lua Address PR comments 2018-05-08 15:50:25 +00:00
turnbot.lua profiles api v2 2017-07-18 10:09:22 +00:00