# A layer at the base of the transport stack, covering tunnels, as well as round end-caps for anything else.
id: road-base-fill
source: spirit-local
source-layer: roads
type: line
# 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.
filter:
  - 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]
paint:
  line-color: !!inc/file style/inc/road-fill-color.yaml
  line-width:
    - interpolate
    - - exponential
      - 1.35
    - - zoom
    - 12
    - - match
      - [get, highway]
      - motorway
      - 2
      - trunk
      - 1.5
      - primary
      - 1.5
      - secondary
      - 1
      - tertiary
      - 1
      - unclassified
      - 1
      - residential
      - 1
      - living_street
      - 1
      - service
      - - match
        - [to-string, [get, minor]]
        - "true"
        - 0.2
        - 0.5
      - 1
    - 20
    - - match
      - [get, highway]
      - motorway
      - 25
      - trunk
      - 20
      - primary
      - 20
      - secondary
      - 15
      - tertiary
      - 15
      - unclassified
      - 10
      - residential
      - 10
      - living_street
      - 10
      - service
      - - match
        - [to-string, [get, minor]]
        - "true"
        - 3
        - 6
      - 10

layout:
  line-cap: round
  line-sort-key:
    - +
    - ['-', [get, z_order]]
    - - '*'
      - [get, layer]
      - -1000
