[FEATURE] Avoid zero value for `direction` type in custom schema
Is your feature request related to a problem? Please describe.
The custom YAML schema defines the direction type as
direction- Maps "-1" to -1, "1" "yes" or "true" to 1, and everything else to 0. See Key:oneway.
As a result, the default value 0 is set for the vast majority of highway features resulting in an unnecessary increase in tile size.
Describe the solution you'd like
Limit the possible values for the direction to 1 and -1 leaving the attribute undefined otherwise:
direction- Maps "-1" to -1, "1" "yes" or "true" to 1, and everything else leaves the attribute unset (null) . See Key:oneway.
Describe alternatives you've considered
Calculate this attribute using an expression of type int
- key: oneway
# type: direction # would add 0 elsewhere
type: int
value:
1:
oneway: ['yes', '1', 'true']
-1:
oneway: '-1'
Additional context
OMT and planetiler-openmaptiles also avoid adding oneway: 0 attributes
@phanecak-maptiler do you know if direction=0 is strictly necessary for openmaptiles schema? I'd be up for changing the default behavior of direction conversion from -1/0/1 to -1/null/1 but that would affect openmaptiles as well.
Another option to address this issue in a more general way is to add a nullif: option to attributes. If the calculated/final value of the attribute is equal to any of the nullif values, the attribute would be omitted from the tile feature. For example:
- key: oneway
type: direction
nullif: 0 # Avoid oneway=0
- key: bridge
nullif: ['no', 'No', 0] # Avoid several flavors of non-bridges
- key: is_bridge
tag_value: bridge
type: boolean
nullif: false # Avoid is_bridge=false