Atlaslog
Atlaslog / MapLibre GL JS / API / setPaintProperty
MapLibre GL JS · API reference

setPaintProperty

Quick answer

setPaintProperty < K extends keyof AllPaintProperties >( layerId : string , name : K , value : AllPaintProperties [ K ], options? : StyleSetterOptions ).

Last verified 2026-11-03 · MapLibre GL JS 4.x · Cite this page
Runnable examplesChinese noteAll API topics
setPaintProperty()

setPaintProperty<K extends keyof AllPaintProperties>(layerId: string, name: K, value: AllPaintProperties[K], options?: StyleSetterOptions): this

Defined in: ui/map.ts:3704

Sets the value of a paint property in the specified style layer.

Type Parameters

Type Parameter
K extends keyof AllPaintProperties

Parameters

Parameter Type Description
layerId string The ID of the layer to set the paint property in.
name K The name of the paint property to set.
value AllPaintProperties[K] The value of the paint property to set. Must be of a type appropriate for the property, as defined in the MapLibre Style Specification. Pass null to unset the existing value.
options? StyleSetterOptions Options object.

Returns

this

Example

map.setPaintProperty('my-layer', 'fill-color', '#faafee');

See


TutorialsAPI index
English reference text adapted from the official MapLibre GL JS documentation, © MapLibre contributors, licensed under BSD-3-Clause.
Original page: https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/ · Chinese note: /maplibre/api/set-paint-property.html
Cite this page

Atlaslog (2026). setPaintProperty. https://www.jingweizhi.com/en/maplibre/api/set-paint-property.html (accessed 2026-11-03).