Skip to content

LayerReferenceSchema

const LayerReferenceSchema: ZodObject<{ $ref: ZodString; }, "strip", ZodTypeAny, { $ref: string; }, { $ref: string; }>

Defined in: packages/core/src/schemas/layer.schema.ts:1458

Layer reference for reusing global layer definitions.

References a layer defined in the global layers object using JSON Pointer-like syntax: #/layers/layerName

# Global definition (a multi-page root document)
layers:
bikeLayer:
id: bikes
type: line
source:
type: geojson
url: "https://example.com/bikes.geojson"
paint:
line-color: "#16a34a"
line-width: 2
# Reference in a map
pages:
- path: "/"
title: "Bike lanes"
blocks:
- type: map
id: bike-map
config:
center: [-74.006, 40.7128]
zoom: 12
mapStyle: "https://tiles.openfreemap.org/styles/liberty"
layers:
- $ref: "#/layers/bikeLayer"