Improve HGV access parsing
4df82f526d666e7e58ecbd729e33ebdf15b8ed8a added a dedicated parser for hgv values but in the current state it doesn't cover all cases.
As the transportation modes follow a hierarchical approach, an access restriction such as motor_vehicle=no would also block trucks unless explicitly overridden by an accompanying hgv tag. A custommodel based on the roads vehicle would therefore need to evaluate both hgv and road_access EVs to make an appropriate decision.
Based on this, a check for fully closed road sections with the roads vehicle would look like the following:
"if": "road_access == NO || hgv == NO", "multiply_by": "0"This would get more complex if other access types need to be blocked as well, but the main problem with this approach is that road_access is in fact encoding access for a car:
A road tagged with motorcar:false+hgv=yes would falsely block a HGV vehicle.
Wouldn't it be better to reuse the code from the OSMRoadAccessParser instead? e.g.
else if (name.equals(RoadAccess.KEY))
return new OSMRoadAccessParser(lookup.getEnumEncodedValue(RoadAccess.KEY, RoadAccess.class), TransportationMode.CAR);
else if (name.equals(Hgv.KEY))
return new OSMRoadAccessParser(lookup.getEnumEncodedValue(Hgv.KEY, RoadAccess.class), TransportationMode.HGV);The only real problem would be the mismatch between the values of RoadAccess and Hgv.
RoadAccess:
- CUSTOMERS
- FORESTRY
- PRIVATE
- OTHER
Hgv:
- MISSING
- DESIGNATED
- DISCOURAGED
We would need to move the additional Hgv values into the RoadAccess enum. This would be according to how OSM is treating the values: https://wiki.openstreetmap.org/wiki/Key:access#List_of_possible_values
e.g:
RoadAccess:
- YES
- DESTINATION
- CUSTOMERS
- DELIVERY
- FORESTRY
- AGRICULTURAL
- PRIVATE
- DESIGNATED
- DISCOURAGED
- OTHER
- NO
Source: graphhopper/graphhopper