id: road-bridge-casing
source: spirit-local
source-layer: roads
type: line
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]
    - - all
      - - in
        - [get, highway]
        - - literal
          - - footway
            - cycleway
      - [">=", [zoom], 15]
  - [get, bridge]
paint:
  line-color: black
  line-width:
    - interpolate
    - - exponential
      - 1.35
    - - zoom
    - 12
    - - match
      - [get, highway]
      - motorway
      - 4
      - trunk
      - 3.5
      - primary
      - 3.5
      - secondary
      - 2
      - tertiary
      - 2
      - unclassified
      - 1.5
      - residential
      - 1.5
      - living_street
      - 1.5
      - service
      - - match
        - [to-string, [get, minor]]
        - "true"
        - 0.5
        - 1
      - footway
      - .2
      - cycleway
      - .2
      - 1.5
    - 20
    - - match
      - [get, highway]
      - motorway
      - 40
      - trunk
      - 30
      - primary
      - 30
      - secondary
      - 25
      - tertiary
      - 25
      - unclassified
      - 20
      - residential
      - 20
      - living_street
      - 20
      - service
      - - match
        - [to-string, [get, minor]]
        - "true"
        - 10
        - 14
      - footway
      - 4
      - cycleway
      - 4
      - 20
layout:
  line-cap: butt
  line-sort-key:
    - +
    - [get, z_order]
    - - '*'
      - [get, layer]
      - 1000
