Skip to content

Add a new layer below labels

Use the second argument of addLayer to add a layer below labels.

---
title: Add a new layer below labels
description: Use the second argument of addLayer to add a layer below labels.
type: geojson
options:
  zoom: 4
  center: [ -88.13734351262877, 35.137451890638886 ]
style:
  extends: https://styles.trailsta.sh/osm-liberty.json
  layers:
    - type: fill
      # This is the important part of this example:
      # layers can have a `beforeLayerId` property containing a string
      # representing another layer's name. if the other layer
      # exists in the stylesheet already, the new layer will be positioned
      # right before that layer in the stack, making it possible to put
      # 'overlays' anywhere in the layer stack.
      # Insert the layer beneath the first symbol layer.
      beforeLayerId: road_one_way_arrow
      fill-opacity: .5
      fill-color: '#f08'
---
https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_urban_areas.geojson


View Map on Ultra
Edit Query on Ultra
View MapLibre Example