Skip to main content

Layer

Layer is a style layer that renders geospatial data on the map. Follow the MapLibre Style Spec for Layer definitions.

Basic Usage

<Layer
type="fill"
id="parks"
source="parks-source"
paint={{ "fill-color": "green", "fill-opacity": 0.5 }}
layout={{ visibility: "visible" }}
/>

Using Expressions

<Layer
type="fill"
id="parks"
source="parks-source"
paint={{
"fill-color": [
"interpolate",
["linear"],
["get", "elevation"],
0,
"blue",
100,
"red",
],
}}
/>

Props​

source​

Type: string

Required: No

source-layer​

Type: string

Required: No

filter​

Type: FilterSpecification

Required: No

id​

A string that uniquely identifies the layer in the style.

Type: string

Required: No

minzoom​

The minimum zoom at which the layer gets parsed and appears.

Type: number

Required: No

maxzoom​

The maximum zoom at which the layer gets parsed and appears.

Type: number

Required: No

paint​

Type: never

Required: No

layout​

Type: never

Required: No

beforeId​

The layer will appear under this layer.

Type: string

Required: No

afterId​

The layer will appear above this layer.

Type: string

Required: No

layerIndex​

Inserts the layer at the specified index.

Type: number

Required: No

testID​

Type: string

Required: No