Add support for non-numerical units in car profile for maxheight #4763
This commit is contained in:
parent
8114104a43
commit
2987292cc0
@ -8,6 +8,7 @@
|
||||
- Profile:
|
||||
- FIXED: `highway=service` will now be used for restricted access, `access=private` is still disabled for snapping.
|
||||
- ADDED #4775: Exposes more information to the turn function, now being able to set turn weights with highway and access information of the turn as well as other roads at the intersection [#4775](https://github.com/Project-OSRM/osrm-backend/issues/4775)
|
||||
- FIXED: #4763: Add support for non-numerical units in car profile for maxheight [#4763](https://github.com/Project-OSRM/osrm-backend/issues/4763)
|
||||
|
||||
# 5.15.0
|
||||
- Changes from 5.14.3:
|
||||
|
5573
data/maxheight.geojson
Normal file
5573
data/maxheight.geojson
Normal file
File diff suppressed because it is too large
Load Diff
@ -39,7 +39,12 @@ Feature: Car - Handle physical limitation
|
||||
Scenario: Car - Limited by height
|
||||
Then routability should be
|
||||
| highway | maxheight:physical | maxheight | bothw |
|
||||
| primary | | | x |
|
||||
| primary | 1 | | |
|
||||
| primary | 3 | | x |
|
||||
| primary | | 1 | |
|
||||
| primary | | 3 | x |
|
||||
| primary | | default | x |
|
||||
| primary | | none | x |
|
||||
| primary | | no-sign | x |
|
||||
| primary | | unsigned | x |
|
||||
|
@ -55,11 +55,24 @@ function Measure.parse_value_kilograms(value)
|
||||
end
|
||||
end
|
||||
|
||||
-- default maxheight value defined in https://wiki.openstreetmap.org/wiki/Key:maxheight#Non-numerical_values
|
||||
local default_maxheight = 4.5
|
||||
-- Available Non numerical values equal to 4.5; below_default and no_indications are not considered
|
||||
local height_non_numerical_values = Set { "default", "none", "no-sign", "unsigned" }
|
||||
|
||||
--- Get maxheight of specified way in meters. If there are no
|
||||
--- max height, then return nil
|
||||
function Measure.get_max_height(raw_value)
|
||||
function Measure.get_max_height(raw_value,way)
|
||||
if raw_value then
|
||||
return Measure.parse_value_meters(raw_value)
|
||||
if height_non_numerical_values[raw_value] then
|
||||
if way then
|
||||
return way:get_location_tag('maxheight') or default_maxheight
|
||||
else
|
||||
return default_maxheight
|
||||
end
|
||||
else
|
||||
return Measure.parse_value_meters(raw_value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -465,8 +465,8 @@ end
|
||||
function WayHandlers.handle_height(profile,way,result,data)
|
||||
local keys = Sequence { 'maxheight:physical', 'maxheight' }
|
||||
local forward, backward = Tags.get_forward_backward_by_set(way,data,keys)
|
||||
forward = Measure.get_max_height(forward)
|
||||
backward = Measure.get_max_height(backward)
|
||||
forward = Measure.get_max_height(forward,way)
|
||||
backward = Measure.get_max_height(backward,way)
|
||||
|
||||
if forward and forward < profile.vehicle_height then
|
||||
result.forward_mode = mode.inaccessible
|
||||
|
Loading…
Reference in New Issue
Block a user