id: road-text
source: spirit-local
source-layer: roads
type: symbol
filter:
# This messy filter could be done with a [step, [zoom], ..., N, ...] but this
# would require re-stating the conditions for all lower zoom for each step.
# Instead, it requires one of the any branches is met, and each branch involves
# a zoom level conditional. If the zoom-level part is omitted, the results look
# odd when zooming in and out.
  - all
  - - any
    - - all # Allow certain classifications to appear when they are included in the source
      - - in
        - [get, highway]
        - - literal
          - - motorway
            - trunk
            - primary
            - secondary
            - tertiary
            - unclassified
            - residential
            - living_street
    - - all
      - [==, [get, highway], service]
      - [==, [get, minor], null]
      - [">=", [zoom], 14]
    - - all
      - [==, [get, highway], service]
      - [">=", [zoom], 15]
  - ['!', [get, tunnel]]
  - ['!', [get, bridge]]
paint:
  text-color: black
  text-halo-color: !!inc/file style/inc/road-fill-color.yaml
  text-halo-width: 1.5
  text-halo-blur: 1
layout:
  text-font: !!inc/file style/inc/regular-font.yaml
  text-field: '{name}'
  symbol-placement: line
  text-size:
    - interpolate
    - - exponential
      - 1.35
    - [zoom]
    - 12
    - 12
    - 20
    - 18
  symbol-spacing: 300
