map-gl-utils

0.43.0

Overview

Map-GL-Utils (formerly Mapbox-GL-Utils) adds a number of utility functions and syntactic sugar to a Mapbox GL JS or Maplibre GL JS map instance. If you write a lot of interactive map code, you may appreciate the more concise form, and simpler API.

Full documentation: https://stevage.github.io/map-gl-utils

Major features:

  • No need to distinguish between paint, layout and other properties.
  • All properties can be expressed as camelCase rather than kebab-case.
  • Layer operations can act on multiple layers (given by array, regex or filter function), not just one.
  • Source types, layer types and property names are incorporated into function names: addGeoJSON(), addCircleLayer(), setCircleRadius(), getTextFont()...
  • Adding layers and sources is idempotent: call addLineLayer() multiple times to create, then update the layer.
  • Some other convenience functions: show(), hide(), onLoad(), setData(), fontsInUse()
  • Better click and hover functions: hoverPointer(), hoverFeatureState(), hoverPopup(), clickLayer()
  • Some functions behave better: removeLayer() (not an error if layer doesn't exist), removeSource() (removes attached layers automatically), setFilter() (works on multiple layers at once), setData() clears data if no GeoJSON provided.

Usage

To use without any build process:

<script src="https://unpkg.com/map-gl-utils"></script>

then

U.init(map)

With Webpack etc:

const mapgl = require('maplibre-gl'); // or require('mapbox-gl');
const map = new mapgl.Map({ ... });

// or:
import U from 'map-gl-utils';
U.init(map);

// A small number of methods (eg hoverPopup) require access to the maplibre-gl/mapbox-gl library itself, in order to instantiate other objects.
require('map-gl-utils').init(map, mapgl);

The default distribution is an ES2015 module with no transpiling. If you experience any syntax issues (such as using older JavaScript versions), use the UMD bundle instead:

// Adds U property to map, containing these methods.
require('map-gl-utils/umd').init(map);

If you want to use Flow types:

import type MapGlUtils from 'map-gl-utils/src/index'

Guide

Working with layers

The props object passed when adding a layer can freely mix paint, layout and other properties. Property keys can be specified in camelCase or kebab-case:

map.U.addCircleLayer('trees-circle', 'trees', {
    circleColor: 'green', // paint property
    circleRadius: ['interpolate', ['zoom'], 12, 3, 15, 5], // paint property
    circleSortKey: ['get', 'tree-sort-key'], // layout property
    filter: ['!=', 'type', 'stump'], // other property
});

Almost every method that works with existing layers (eg, show()) can work with multiple layers. There are four ways to specify the layer(s) you want to modify:

  • string: map.U.show('trees-label'); map.U.show('trees-circle');
  • array of strings: map.U.show(['trees-label', 'trees-circle']);
  • regular expression: map.U.show(/^trees-/);
  • function that takes a layer, and returns truthy: map.U.show(layer => layer.source === 'trees');

Adding sources

Methods that add sources return an object ("SourceBoundUtils" in this documentation) that can be chained to allow layers to be added to it:

map.U.addGeoJSONSource('properties')
.addCircleLayer('properties-line', { lineWidth: 3 })
.addSymbolLayer('properties-fill', { fillColor: 'hsla(30,30%,60%,0.5)' })

Adding and removing layers

// Conveniently add a line feature, mixing paint, layout and other properties.
// Notice you can use camelCase for all property names.
map.U.addLineLayer('mylines', 'mysource', {
    lineWidth: 3,
    lineCap: 'round',
    minzoom: 11
});

// Also addFillLayer, addFillExtrusionLayer, addRasterLayer, addVideoLayer, addSymbolLayer, addHillshadeLayer, addHeatmapLayer
map.U.addCircleLayer('mycircles', 'mysource', { circleStrokeColor: 'red' });
// if the layer already exists, calling add*Layer simply updates any of the properties
map.U.addCircleLayer('mycircles', 'mysource', { circleStrokeColor: 'red', circleRadius: 4, filter: ['==', 'type', 'active'});


// and of course add the layer "before" another layer if needed:
map.U.addLineLayer('mylayer', 'mysource', { lineColor: 'red' }, 'toplayer');

// removeLayer() doesn't throw errors if the layers don't exist
map.U.removeLayer(['towns','town-labels']);

Adding and removing sources

// Simpler way to create GeoJSON source:
map.U.addGeoJSON('mysource', geojson);

// Or create a GeoJSON source with initially blank data. This is very convenient if you're loading
// the data separately and will call .setData() later.
map.U.addGeoJSON('mysource');

// Simpler ways to create a vector tile source:
map.U.addVector('mysource', 'mapbox://foo.blah');
map.U.addVector('mysource', 'https://example.com/tiles/{z}/{x}/{y}.pbf');

// Additional properties still work
map.U.addVector('mysource', 'https://example.com/tiles/{z}/{x}/{y}.pbf', { maxzoom: 13 });

// There's also addRaster(), addRasterDem(), addImage(), addVideo()
// Calling any of the add* functions simply updates the source definition if it exists already.

// Automatically removes any layers using these sources. Not an error if sources don't exist.
map.U.removeSource(['buildings', 'roads']);

// You can also use the returned object to add layers conveniently:
map.U.addGeoJSON('buildings', 'data/buildings.geojson')
    .addFillExtrusion('buildings-3d', {
        fillExtrusionHeight: 100,
        fillExtrusionColor: 'grey'
    }).addLineLayer('buildings-footprint', {
        lineColor: 'lightblue'
    });

// Replace the source on an existing layer. (Actually removes and re-adds it.)
map.U.setLayerSource('buildings', 'newsource');
map.U.setLayerSource(['buildings-3d', 'buildings-outline]', 'newsource', 'newsourcelayer');

// To change the source layer, pass a third argument, or null to clear it (if switching from vector tiles to geojson)
map.U.setLayerSource('buildings', 'mylocalbuildings', null);

Setting properties and updating data

// Every property has a setXxx() form:
map.U.setTextSize('mylayer', 12);

// And they all work on multiple layers at once:
map.U.setLineWidth(['mylayer', 'mylayer-highlight'], 4);
map.U.setLineOpacity(/^border-/, 0);
map.U.setFillColor(layer => layer.source === 'farms', 'green');

// There's also a more familiar setProperty() form.
map.U.setProperty('mylayer', 'line-width', 3);
// Existing properties aren't touched
map.U.setProperty('mylayer', {
    textSize: 12,
    textColor: 'red'
});

// There's a `get...` version of every function, too.
map.U.getFillColor('water')

// Simpler way to update source data:
map.U.setData('mysource', data);

// you can leave out the data parameter to clear out a GeoJSON source:
map.U.setData('mysource');

// Easier to remember way to turn layers on and off:
map.U.show('mylayer');
map.U.hide('mylayer');
map.U.toggle(['mylayer', 'myotherlayer'], isVisible);

// To avoid name clashes such as with 'raster', you can use a longer form ending
// with either ...Layer() or ...Source()

map.U.addRasterSource('myrastersource', { type: 'raster', url: 'mapbox://mapbox.satellite', tileSize: 256 });
map.U.addRasterLayer('myrasterlayer', 'myrastersource', { rasterSaturation: 0.5 });

Hovering and clicking

// Use the mouse 'finger' cursor when hovering over this layer.
map.U.hoverPointer('mylayer');

// If you pass several layers, it correctly handles moving from one layer to another
// Use the mouse 'finger' cursor when hovering over this layer.
map.U.hoverPointer(['regions-border', 'regions-fill']);

// Sets a "hover" feature-state to be true or false as the mouse moves over features in this layer.
// Requires that features have an `id`.
map.U.hoverFeatureState('mylayer');

// Want to apply the hover feature-state to a different source?
// For instance, you hover over a label, but want to highlight the surrounding boundary.
map.U.hoverFeatureState('town-labels', 'boundaries', 'town-boundaries');

// You can also add additional event handlers:
map.U.hoverFeatureState('mylayer', 'mysource', 'mysourcelayer',
    e => console.log(`Entered ${e.features[0].id}`),
    e => console.log(`Left ${e.oldFeatureid}`);

// Shows a popup when a feature is hovered over or clicked.
// The third argument is an options object, passed to the Popup constructor.
// callback is called as: (feature, popup) => htmlString
// Make sure you passed the mapboxgl library itself when initialising: U.init(map, mapboxgl).
map.U.hoverPopup('mylayer', f => `<h3>${f.properties.Name}</h3> ${f.properties.Description}`, { anchor: 'left' });
map.U.clickPopup('mylayer', f => `<h3>${f.properties.Name}</h3> ${f.properties.Description}`, { maxWidth: 500 });

// clickLayer() is like .on('click)', but can take an array and adds a 'features' member
// to the event, for what got clicked on.
map.U.clickLayer(['towns', 'town-labels'], e => panel.selectedId = e.features[0].id);

// clickOneLayer tests multiple layers in order, firing callback on the first one that
// is hit. The callback is passed { feature, features, layer, event }.
map.U.clickOneLayer(['town-labels', 'state-boundaries'], e => {
    if (e.layer === 'town-labels') {
        setView('town');
        panel.selectedId = e.features[0].id;
    } else if (e.layer === 'state-boundaries') {
        setView('state');
        panel.selectedId = e.features[0].id;
    }
});

// Optionally pass in an extra callback which is fired for clicks that miss all layers:
map.U.clickOneLayer(['town-labels', 'state-boundaries'], e => {...}, e => {
    console.log('Missed everything');
});

// All these functions return an "undo" function that removes the handlers added:
const remove = map.U.hoverPopup('mylayer', showPopupFunc);
//...
remove(); // no more hover popup

Other functions

// Like on('load') but fires immediately (and reliably) any time after map already loaded.
map.U.onLoad(callback);
// returns a promise if no callback:
await map.U.onLoad();

// Gets the layer definition. Mapbox's `getLayer()` has weird paint and layout properties.
const layer = map.U.getLayerStyle('mylayer');

// Resets all other properties to default first. Ignores non-paint, non-layout properties.
map.setLayerStyle('mylayer', {
    lineWidth: 3
});

// properties() converts an object to a layer object accepted by Mapbox-GL-JS
map.addLayer(map.U.properties({
    id: 'mylayer',
    source: 'mysource',
    type: 'line',
    lineWidth: 3,
    lineCap: 'round',
    minzoom: 11,
    filter: ['==', 'status', 'confirmed']
}));

// layerStyle() is flexible, pass as many or as few of id, source, and type (in that order) as you like:
map.U.layerStyle('mylayer', 'mysource', 'line', { ... })
map.U.layerStyle('mylayer', 'mysource', { ... })
map.U.layerStyle('mylayer', { ... })
map.U.layerStyle({ ... })


// Hide/show/toggle all the layers attached to this source
map.U.hideSource('buildings');
map.U.showSource('buildings');
map.U.toggleSource('buildings', true);

// Update several filters at once.
map.U.setFilter(['buildings-fill', 'buildings-outline', 'buildings-label'], [...]);

// Conveniently load an image into the map in one step
map.U.loadImage('marker', '/assets/marker-pin.png');
map.U.loadImage('marker', '/assets/marker-pin@2x.png', { pixelRatio: 2}).then(/* ... */;


// Update the map style's root "transition" property
map.U.setTransition({ delay: 1000, delay: 0});

// Get a list of fonts used in symbol layers with fontsUsed(). Useful for quickly getting some text displaying.
const fonts = map.U.fontsInUse();
map.U.addSymbolLayer('labels', 'mysource', { textFont: fonts[0], textField: '{label}' });

Contrived example

map.U.onload(() => {
    map.U.addGeoJSON('towns');
    map.U.addCircleLayer('small-towns', 'towns', { circleColor: 'green', filter: ['==', 'size', 'small']});
    map.U.addCircleLayer('large-towns', 'towns', {
        circleColor: 'red',
        filter: ['==', 'size', ['large']],
        circleStrokeWidth: ['case', ['to-boolean', ['feature-state', 'hover']], 5, 1]
    );
    map.U.setCircleRadius(['small-towns', 'large-towns'], 12);
    map.U.hoverPointer(['small-towns', 'large-towns']);
    map.U.hoverFeatureState('large-towns');
    // update the source layer when data is available
    d3.json('http://example.com/towns.json', data => map.U.setData('towns', data));
});

Credits

Map-GL-Utils was written by, and maintained, by Steve Bennett, a freelance map developer.

Documentation built with documentation.js.

Packaging uses rollup.js and Babel.

Flow is used internally, including types from Mapbox GL JS.

Tests are run using Jest.

Changelog

Changelog

0.43.0

  • revert to internally using map.addLayer rather than map.setStyle for performance

0.42.0

  • fixed UMD packaging some more by removing esmodules: true from rollup config.

0.41.0

  • fix UMD packaging (thanks @lasseborly!)
  • fix ESM packaging (class properties not transformed properly)
  • update to Mapbox GL Style Spec 13.22 ("sky" properties)

0.40.0

  • rename to Map-GL-JS and explicitly support Maplibre GL JS
  • add Flow types
  • add JSdocs and use documentation.js to make documentation
  • change the packaging again, so dist/index.esm.js is the default, ES module, and umd/index.js is the UMD module.

0.39.0

  • remove kebab-case dependency

0.38.0

  • scrapped the CommonJS build. NodeJS is able to handle ES modules these days.
  • rewrote the "arrayify" logic
  • correctly handle 'hover' transitions across overlapping layers
  • probably correctly gives an "off" handler so this kind of thing works: const off = map.U.hoverPointer(['layer1','layer2']); /* ... */ off()
  • more tests

0.37.0

  • onLoad() now returns a promise if no callback provided.

0.36.0

0.35.0

addCircleLayer

Adds a layer of type circle.

addCircleLayer(id: string, props: {}, before: string?): void
Parameters
id (string)
props ({})
before (string?)
Returns
void

addFillExtrusionLayer

Adds a layer of type fill-extrusion.

addFillExtrusionLayer(id: string, props: {}, before: string?): void
Parameters
id (string)
props ({})
before (string?)
Returns
void

addFillLayer

Adds a layer of type fill.

addFillLayer(id: string, props: {}, before: string?): void
Parameters
id (string)
props ({})
before (string?)
Returns
void

addGeoJSONSource

Create a GeoJSON layer.

addGeoJSONSource(id: string, geojson: GeoJSON?, props: GeoJSONSourceSpecification?): SourceBoundUtils
Parameters
id (string)
geojson (GeoJSON? = {type:'FeatureCollection',features:[]})
props (GeoJSONSourceSpecification?)
Returns
SourceBoundUtils

addHeatmapLayer

Adds a layer of type heatmap.

addHeatmapLayer(id: string, props: {}, before: string?): void
Parameters
id (string)
props ({})
before (string?)
Returns
void

addHillshadeLayer

Adds a layer of type hillshade.

addHillshadeLayer(id: string, props: {}, before: string?): void
Parameters
id (string)
props ({})
before (string?)
Returns
void

addImageSource

Adds an image source

addImageSource(sourceId: string, props: object): SourceBoundUtils
Parameters
sourceId (string) ID of the new source.
props (object) Properties defining the source, per the style spec.
Returns
SourceBoundUtils

addLayer

Adds a layer, given an id, source, type, and properties.

addLayer(id: string, source: string, type: string, props: {}, before: string?): SourceBoundUtils
Parameters
id (string)
source (string)
type (string)
props ({})
before (string?)
Returns
SourceBoundUtils

addLineLayer

Adds a layer of type line.

addLineLayer(id: string, props: {}, before: string?): void
Parameters
id (string)
props ({})
before (string?)
Returns
void

addRasterDemSource

Adds a raster-dem source

addRasterDemSource(sourceId: string, props: object): SourceBoundUtils
Parameters
sourceId (string) ID of the new source.
props (object) Properties defining the source, per the style spec.
Returns
SourceBoundUtils

addRasterLayer

Adds a layer of type raster.

addRasterLayer(id: string, props: {}, before: string?): void
Parameters
id (string)
props ({})
before (string?)
Returns
void

addRasterSource

Adds a raster source

addRasterSource(sourceId: string, props: object): SourceBoundUtils
Parameters
sourceId (string) ID of the new source.
props (object) Properties defining the source, per the style spec.
Returns
SourceBoundUtils

addRasterSource

Adds a raster source

addRasterSource(sourceId: string, props: object): SourceBoundUtils
Parameters
sourceId (string) ID of the new source.
props (object) Properties defining the source, per the style spec.
Returns
SourceBoundUtils

addSymbolLayer

Adds a layer of type symbol.

addSymbolLayer(id: string, props: {}, before: string?): void
Parameters
id (string)
props ({})
before (string?)
Returns
void

addVectorSource

Adds a vector source

addVectorSource(sourceId: string, props: object, extraProps: {}, data: string?): SourceBoundUtils
Parameters
sourceId (string) ID of the new source.
props (object) Properties defining the source, per the style spec.
extraProps ({} = {})
data (string?) Optional URL of source tiles (.../{z}/{x}/{y}...), mapbox:// URL or TileJSON endpoint.
Returns
SourceBoundUtils
Example
addVector('mysource', 'http://example.com/tiles/{z}/{x}/{y}.pbf', { maxzoom: 13 });

addVideoLayer

Adds a layer of type video.

addVideoLayer(id: string, props: {}, before: string?): void
Parameters
id (string)
props ({})
before (string?)
Returns
void

addVideoSource

Adds a video source

addVideoSource(sourceId: string, props: object): SourceBoundUtils
Parameters
sourceId (string) ID of the new source.
props (object) Properties defining the source, per the style spec.
Returns
SourceBoundUtils

clickLayer

Fire a callback whenever a feature in these layers is clicked.

clickLayer
Parameters
layers ((string | Array<string> | RegExp | function)) Layers to attach handler to.
cb (function) Callback that receives event with .features property
Returns
any: A function that removes the handler.

clickOneLayer

Detects a click in the first of a series of layers given, and fires a callback.

clickOneLayer(layerRef: LayerRef, cb: LayerCallback, noMatchCb: LayerCallback?, layers: (string | Array<string> | RegExp | function)): OffHandler
Parameters
layerRef (LayerRef)
cb (LayerCallback) Callback, receives { event, layer, feature, features } .
noMatchCb (LayerCallback?) Callback when a click happens that misses all these layers. Receives { event } .
layers ((string | Array<string> | RegExp | function)) Layers to attach handler to.
Returns
OffHandler: A function to remove the handler.

clickPopup

Show a popup whenever a feature in these layers is clicked.

clickPopup(layers: (string | Array<string> | RegExp | function), htmlFunc: function ({}): void, popupOptions: Object<PopupOptions>): OffHandler
Parameters
layers ((string | Array<string> | RegExp | function)) Layers to attach handler to.
htmlFunc (function ({}): void) Function that receives feature and popup, returns HTML.
popupOptions (Object<PopupOptions> = {}) Options passed to Popup() to customise popup.
Returns
OffHandler: A function that removes the handler.
Example
clickPopup('mylayer', f => `<h3>${f.properties.Name}</h3> ${f.properties.Description}`, { maxWidth: 500 });

fontsInUse

Gets array of font names in use, determined by traversing style. Does not detect fonts in all possible situations.

fontsInUse(): Array<string>
Returns
Array<string>

getLayerStyle

Gets the layer definition for a given layer id, as per the style spec..

getLayerStyle(layerId: string): LayerSpecification
Parameters
layerId (string)
Returns
LayerSpecification

hide

Makes the given layers hidden.

hide
Parameters
Layer ((string | Array<string> | RegExp | function)) to toggle.

hideSource

Makes all layers depending on a given source hidden.

hideSource

hoverFeatureState

Updates feature-state of features in the connected source[s] whenever hovering over a feature in these layers.

hoverFeatureState
Parameters
layer (any) Layer(s) to add handler to.
source ((string | Array)?) Source whose features will be updated. If not provided, use the source defined for the layer.
sourceLayer (string?) Source layer (if using vector source)

hoverLayer

Fires a callback when mouse hovers over a feature in these layers.

hoverLayer
Parameters
layers ((string | Array<string> | RegExp | function)) Layers to attach handler to.
Returns
any: A function to remove the handler.

hoverPointer

Sets Map's cursor to 'pointer' whenever the mouse is over these layers.

hoverPointer(layerOrLayers: LayerRef): function (): void
Parameters
layerOrLayers (LayerRef)
Returns
function (): void: A function to remove the handler.

hoverPopup

Show a popup whenever hovering over a feature in these layers.

hoverPopup(layers: (string | Array<string> | RegExp | function), htmlFunc: LayerCallback, popupOptions: Object<PopupOptions>): OffHandler
Parameters
layers ((string | Array<string> | RegExp | function)) Layers to attach handler to.
htmlFunc (LayerCallback) Function that receives feature and popup, returns HTML.
popupOptions (Object<PopupOptions> = {}) Options passed to Popup() to customise popup.
Returns
OffHandler
Example
hoverPopup('mylayer', f => `<h3>${f.properties.Name}</h3> ${f.properties.Description}`, { anchor: 'left' });

loadImage

Adds an image for use as a symbol layer, from a URL.

loadImage(id: string, url: string, options: StyleImageMetadata?): any
Parameters
id (string)
url (string)
options (StyleImageMetadata?)
Returns
any
Example
loadImage('marker', '/assets/marker-pin@2x.png', { pixelRatio: 2})

onLoad

Callback that fires when map loads, or immediately if map is already loaded.

onLoad(cb: function (void): void?): Promise
Parameters
cb (function (void): void?)
Returns
Promise: Promise, if callback not provided.

properties

Converts a set of properties in pascalCase or kebab-case into a layer objectwith layout and paint properties.

properties(props: {}?): {}?
Parameters
props ({}?)
Returns
{}?

removeSource

Removes one or more sources, first removing all layers that depend on them. Not an error if source doesn't exist.

removeSource
Parameters
sources (SourceRef)

setData

Replaces the current data for a GeoJSON layer.

setData(sourceId: string, data: GeoJSON?)
Parameters
sourceId (string) Id of the source being updated.
data (GeoJSON? = {type:'FeatureCollection',features:[]}) GeoJSON object to set. If not provided, defaults to an empty FeatureCollection.

setFilter

Replace the filter for one or more layers.

setFilter
Parameters
layers ((string | Array<string> | RegExp | function)) Layers to attach handler to.
filter (Array) New filter to set.
Example
map.U.setFilter(['buildings-fill', 'buildings-outline', 'buildings-label'], ['==','level','0']]);

setLayerSource

Changes the source of an existing layer, by removing and readding the source.

setLayerSource
Parameters
layerId ((string | Array<string> | RegExp | function)) Layer[s] whose source will be changed.
sourceId (string) New source ID to set.
sourceLayer (string?) New source layer to set.
Example
setLayerSource(['trees-circle', 'trees-label'], 'allpoints', 'trees')

setProperty

Sets a paint or layout property on one or more layers.

setProperty
Example
setProperty(['buildings-fill', 'parks-fill'], 'fillOpacity', 0.5)

setRootProperty

Set a property on the style's root, such as light or transition.

setRootProperty(propName: string, val: PropValue)
Parameters
propName (string)
val (PropValue)

setTransition

Sets root transition property.

setTransition(val: TransitionSpecification)
Parameters
val (TransitionSpecification)
Example
setTransition({ duration: 500, delay: 100 })

show

Makes the given layers visible.

show
Parameters
Layer ((string | Array<string> | RegExp | function)) to toggle.

showSource

Makes all layers depending on a given source visible.

showSource

toggle

Makes the given layers hidden or visible, depending on an argument.

toggle
Parameters
Layer ((string | Array<string> | RegExp | function)) to toggle.
state (boolean) True for visible, false for hidden.

toggleSource

Makes the given layers connected to a given source hidden or visible, depending on an argument.

toggleSource
Parameters
sourceId (string) Source[s] whose layers will be toggled.
state (boolean) True for visible, false for hidden.

init

Initialises Map-GL-Utils on existing map object.

init(map: UtilsMap, mapgl: MapboxGlLib?): MapGlUtils
Parameters
map (UtilsMap)
mapgl (MapboxGlLib?) Mapbox-GL-JS or Maplibre-GL-JS library. Only needed for later use by hoverPopup() etc.
Returns
MapGlUtils: Initialised MapGlUtils object.

getBackgroundColor

Gets the background-color paint property for a layer.

getBackgroundColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getBackgroundOpacity

Gets the background-opacity paint property for a layer.

getBackgroundOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getBackgroundPattern

Gets the background-pattern paint property for a layer.

getBackgroundPattern(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCircleBlur

Gets the circle-blur paint property for a layer.

getCircleBlur(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCircleColor

Gets the circle-color paint property for a layer.

getCircleColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCircleOpacity

Gets the circle-opacity paint property for a layer.

getCircleOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCirclePitchAlignment

Gets the circle-pitch-alignment paint property for a layer.

getCirclePitchAlignment(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCirclePitchScale

Gets the circle-pitch-scale paint property for a layer.

getCirclePitchScale(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCircleRadius

Gets the circle-radius paint property for a layer.

getCircleRadius(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCircleSortKey

Gets the circle-sort-key layout property for a layer.

getCircleSortKey(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCircleStrokeColor

Gets the circle-stroke-color paint property for a layer.

getCircleStrokeColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCircleStrokeOpacity

Gets the circle-stroke-opacity paint property for a layer.

getCircleStrokeOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCircleStrokeWidth

Gets the circle-stroke-width paint property for a layer.

getCircleStrokeWidth(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCircleTranslate

Gets the circle-translate paint property for a layer.

getCircleTranslate(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getCircleTranslateAnchor

Gets the circle-translate-anchor paint property for a layer.

getCircleTranslateAnchor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillAntialias

Gets the fill-antialias paint property for a layer.

getFillAntialias(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillColor

Gets the fill-color paint property for a layer.

getFillColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillExtrusionBase

Gets the fill-extrusion-base paint property for a layer.

getFillExtrusionBase(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillExtrusionColor

Gets the fill-extrusion-color paint property for a layer.

getFillExtrusionColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillExtrusionHeight

Gets the fill-extrusion-height paint property for a layer.

getFillExtrusionHeight(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillExtrusionOpacity

Gets the fill-extrusion-opacity paint property for a layer.

getFillExtrusionOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillExtrusionPattern

Gets the fill-extrusion-pattern paint property for a layer.

getFillExtrusionPattern(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillExtrusionTranslate

Gets the fill-extrusion-translate paint property for a layer.

getFillExtrusionTranslate(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillExtrusionTranslateAnchor

Gets the fill-extrusion-translate-anchor paint property for a layer.

getFillExtrusionTranslateAnchor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillExtrusionVerticalGradient

Gets the fill-extrusion-vertical-gradient paint property for a layer.

getFillExtrusionVerticalGradient(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillOpacity

Gets the fill-opacity paint property for a layer.

getFillOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillOutlineColor

Gets the fill-outline-color paint property for a layer.

getFillOutlineColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillPattern

Gets the fill-pattern paint property for a layer.

getFillPattern(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillSortKey

Gets the fill-sort-key layout property for a layer.

getFillSortKey(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillTranslate

Gets the fill-translate paint property for a layer.

getFillTranslate(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getFillTranslateAnchor

Gets the fill-translate-anchor paint property for a layer.

getFillTranslateAnchor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHeatmapColor

Gets the heatmap-color paint property for a layer.

getHeatmapColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHeatmapIntensity

Gets the heatmap-intensity paint property for a layer.

getHeatmapIntensity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHeatmapOpacity

Gets the heatmap-opacity paint property for a layer.

getHeatmapOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHeatmapRadius

Gets the heatmap-radius paint property for a layer.

getHeatmapRadius(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHeatmapWeight

Gets the heatmap-weight paint property for a layer.

getHeatmapWeight(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHillshadeAccentColor

Gets the hillshade-accent-color paint property for a layer.

getHillshadeAccentColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHillshadeExaggeration

Gets the hillshade-exaggeration paint property for a layer.

getHillshadeExaggeration(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHillshadeHighlightColor

Gets the hillshade-highlight-color paint property for a layer.

getHillshadeHighlightColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHillshadeIlluminationAnchor

Gets the hillshade-illumination-anchor paint property for a layer.

getHillshadeIlluminationAnchor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHillshadeIlluminationDirection

Gets the hillshade-illumination-direction paint property for a layer.

getHillshadeIlluminationDirection(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getHillshadeShadowColor

Gets the hillshade-shadow-color paint property for a layer.

getHillshadeShadowColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconAllowOverlap

Gets the icon-allow-overlap layout property for a layer.

getIconAllowOverlap(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconAnchor

Gets the icon-anchor layout property for a layer.

getIconAnchor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconColor

Gets the icon-color paint property for a layer.

getIconColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconHaloBlur

Gets the icon-halo-blur paint property for a layer.

getIconHaloBlur(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconHaloColor

Gets the icon-halo-color paint property for a layer.

getIconHaloColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconHaloWidth

Gets the icon-halo-width paint property for a layer.

getIconHaloWidth(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconIgnorePlacement

Gets the icon-ignore-placement layout property for a layer.

getIconIgnorePlacement(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconImage

Gets the icon-image layout property for a layer.

getIconImage(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconKeepUpright

Gets the icon-keep-upright layout property for a layer.

getIconKeepUpright(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconOffset

Gets the icon-offset layout property for a layer.

getIconOffset(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconOpacity

Gets the icon-opacity paint property for a layer.

getIconOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconOptional

Gets the icon-optional layout property for a layer.

getIconOptional(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconPadding

Gets the icon-padding layout property for a layer.

getIconPadding(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconPitchAlignment

Gets the icon-pitch-alignment layout property for a layer.

getIconPitchAlignment(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconRotate

Gets the icon-rotate layout property for a layer.

getIconRotate(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconRotationAlignment

Gets the icon-rotation-alignment layout property for a layer.

getIconRotationAlignment(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconSize

Gets the icon-size layout property for a layer.

getIconSize(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconTextFit

Gets the icon-text-fit layout property for a layer.

getIconTextFit(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconTextFitPadding

Gets the icon-text-fit-padding layout property for a layer.

getIconTextFitPadding(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconTranslate

Gets the icon-translate paint property for a layer.

getIconTranslate(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getIconTranslateAnchor

Gets the icon-translate-anchor paint property for a layer.

getIconTranslateAnchor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineBlur

Gets the line-blur paint property for a layer.

getLineBlur(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineCap

Gets the line-cap layout property for a layer.

getLineCap(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineColor

Gets the line-color paint property for a layer.

getLineColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineDasharray

Gets the line-dasharray paint property for a layer.

getLineDasharray(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineGapWidth

Gets the line-gap-width paint property for a layer.

getLineGapWidth(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineGradient

Gets the line-gradient paint property for a layer.

getLineGradient(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineJoin

Gets the line-join layout property for a layer.

getLineJoin(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineMiterLimit

Gets the line-miter-limit layout property for a layer.

getLineMiterLimit(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineOffset

Gets the line-offset paint property for a layer.

getLineOffset(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineOpacity

Gets the line-opacity paint property for a layer.

getLineOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLinePattern

Gets the line-pattern paint property for a layer.

getLinePattern(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineRoundLimit

Gets the line-round-limit layout property for a layer.

getLineRoundLimit(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineSortKey

Gets the line-sort-key layout property for a layer.

getLineSortKey(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineTranslate

Gets the line-translate paint property for a layer.

getLineTranslate(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineTranslateAnchor

Gets the line-translate-anchor paint property for a layer.

getLineTranslateAnchor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getLineWidth

Gets the line-width paint property for a layer.

getLineWidth(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getRasterBrightnessMax

Gets the raster-brightness-max paint property for a layer.

getRasterBrightnessMax(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getRasterBrightnessMin

Gets the raster-brightness-min paint property for a layer.

getRasterBrightnessMin(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getRasterContrast

Gets the raster-contrast paint property for a layer.

getRasterContrast(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getRasterFadeDuration

Gets the raster-fade-duration paint property for a layer.

getRasterFadeDuration(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getRasterHueRotate

Gets the raster-hue-rotate paint property for a layer.

getRasterHueRotate(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getRasterOpacity

Gets the raster-opacity paint property for a layer.

getRasterOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getRasterResampling

Gets the raster-resampling paint property for a layer.

getRasterResampling(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getRasterSaturation

Gets the raster-saturation paint property for a layer.

getRasterSaturation(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSkyAtmosphereColor

Gets the sky-atmosphere-color paint property for a layer.

getSkyAtmosphereColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSkyAtmosphereHaloColor

Gets the sky-atmosphere-halo-color paint property for a layer.

getSkyAtmosphereHaloColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSkyAtmosphereSun

Gets the sky-atmosphere-sun paint property for a layer.

getSkyAtmosphereSun(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSkyAtmosphereSunIntensity

Gets the sky-atmosphere-sun-intensity paint property for a layer.

getSkyAtmosphereSunIntensity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSkyGradient

Gets the sky-gradient paint property for a layer.

getSkyGradient(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSkyGradientCenter

Gets the sky-gradient-center paint property for a layer.

getSkyGradientCenter(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSkyGradientRadius

Gets the sky-gradient-radius paint property for a layer.

getSkyGradientRadius(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSkyOpacity

Gets the sky-opacity paint property for a layer.

getSkyOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSkyType

Gets the sky-type paint property for a layer.

getSkyType(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSymbolAvoidEdges

Gets the symbol-avoid-edges layout property for a layer.

getSymbolAvoidEdges(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSymbolPlacement

Gets the symbol-placement layout property for a layer.

getSymbolPlacement(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSymbolSortKey

Gets the symbol-sort-key layout property for a layer.

getSymbolSortKey(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSymbolSpacing

Gets the symbol-spacing layout property for a layer.

getSymbolSpacing(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getSymbolZOrder

Gets the symbol-z-order layout property for a layer.

getSymbolZOrder(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextAllowOverlap

Gets the text-allow-overlap layout property for a layer.

getTextAllowOverlap(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextAnchor

Gets the text-anchor layout property for a layer.

getTextAnchor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextColor

Gets the text-color paint property for a layer.

getTextColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextField

Gets the text-field layout property for a layer.

getTextField(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextFont

Gets the text-font layout property for a layer.

getTextFont(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextHaloBlur

Gets the text-halo-blur paint property for a layer.

getTextHaloBlur(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextHaloColor

Gets the text-halo-color paint property for a layer.

getTextHaloColor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextHaloWidth

Gets the text-halo-width paint property for a layer.

getTextHaloWidth(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextIgnorePlacement

Gets the text-ignore-placement layout property for a layer.

getTextIgnorePlacement(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextJustify

Gets the text-justify layout property for a layer.

getTextJustify(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextKeepUpright

Gets the text-keep-upright layout property for a layer.

getTextKeepUpright(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextLetterSpacing

Gets the text-letter-spacing layout property for a layer.

getTextLetterSpacing(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextLineHeight

Gets the text-line-height layout property for a layer.

getTextLineHeight(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextMaxAngle

Gets the text-max-angle layout property for a layer.

getTextMaxAngle(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextMaxWidth

Gets the text-max-width layout property for a layer.

getTextMaxWidth(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextOffset

Gets the text-offset layout property for a layer.

getTextOffset(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextOpacity

Gets the text-opacity paint property for a layer.

getTextOpacity(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextOptional

Gets the text-optional layout property for a layer.

getTextOptional(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextPadding

Gets the text-padding layout property for a layer.

getTextPadding(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextPitchAlignment

Gets the text-pitch-alignment layout property for a layer.

getTextPitchAlignment(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextRadialOffset

Gets the text-radial-offset layout property for a layer.

getTextRadialOffset(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextRotate

Gets the text-rotate layout property for a layer.

getTextRotate(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextRotationAlignment

Gets the text-rotation-alignment layout property for a layer.

getTextRotationAlignment(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextSize

Gets the text-size layout property for a layer.

getTextSize(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextTransform

Gets the text-transform layout property for a layer.

getTextTransform(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextTranslate

Gets the text-translate paint property for a layer.

getTextTranslate(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextTranslateAnchor

Gets the text-translate-anchor paint property for a layer.

getTextTranslateAnchor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextVariableAnchor

Gets the text-variable-anchor layout property for a layer.

getTextVariableAnchor(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getTextWritingMode

Gets the text-writing-mode layout property for a layer.

getTextWritingMode(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

getVisibility

Gets the visibility layout property for a layer.

getVisibility(layer: LayerRef): any
Parameters
layer (LayerRef)
Returns
any

setBackgroundColor

Sets the background-color paint property for one or more layers.

setBackgroundColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setBackgroundOpacity

Sets the background-opacity paint property for one or more layers.

setBackgroundOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setBackgroundPattern

Sets the background-pattern paint property for one or more layers.

setBackgroundPattern(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCircleBlur

Sets the circle-blur paint property for one or more layers.

setCircleBlur(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCircleColor

Sets the circle-color paint property for one or more layers.

setCircleColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCircleOpacity

Sets the circle-opacity paint property for one or more layers.

setCircleOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCirclePitchAlignment

Sets the circle-pitch-alignment paint property for one or more layers.

setCirclePitchAlignment(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCirclePitchScale

Sets the circle-pitch-scale paint property for one or more layers.

setCirclePitchScale(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCircleRadius

Sets the circle-radius paint property for one or more layers.

setCircleRadius(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCircleSortKey

Sets the circle-sort-key layout property for one or more layers.

setCircleSortKey(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCircleStrokeColor

Sets the circle-stroke-color paint property for one or more layers.

setCircleStrokeColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCircleStrokeOpacity

Sets the circle-stroke-opacity paint property for one or more layers.

setCircleStrokeOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCircleStrokeWidth

Sets the circle-stroke-width paint property for one or more layers.

setCircleStrokeWidth(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCircleTranslate

Sets the circle-translate paint property for one or more layers.

setCircleTranslate(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setCircleTranslateAnchor

Sets the circle-translate-anchor paint property for one or more layers.

setCircleTranslateAnchor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillAntialias

Sets the fill-antialias paint property for one or more layers.

setFillAntialias(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillColor

Sets the fill-color paint property for one or more layers.

setFillColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillExtrusionBase

Sets the fill-extrusion-base paint property for one or more layers.

setFillExtrusionBase(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillExtrusionColor

Sets the fill-extrusion-color paint property for one or more layers.

setFillExtrusionColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillExtrusionHeight

Sets the fill-extrusion-height paint property for one or more layers.

setFillExtrusionHeight(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillExtrusionOpacity

Sets the fill-extrusion-opacity paint property for one or more layers.

setFillExtrusionOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillExtrusionPattern

Sets the fill-extrusion-pattern paint property for one or more layers.

setFillExtrusionPattern(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillExtrusionTranslate

Sets the fill-extrusion-translate paint property for one or more layers.

setFillExtrusionTranslate(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillExtrusionTranslateAnchor

Sets the fill-extrusion-translate-anchor paint property for one or more layers.

setFillExtrusionTranslateAnchor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillExtrusionVerticalGradient

Sets the fill-extrusion-vertical-gradient paint property for one or more layers.

setFillExtrusionVerticalGradient(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillOpacity

Sets the fill-opacity paint property for one or more layers.

setFillOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillOutlineColor

Sets the fill-outline-color paint property for one or more layers.

setFillOutlineColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillPattern

Sets the fill-pattern paint property for one or more layers.

setFillPattern(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillSortKey

Sets the fill-sort-key layout property for one or more layers.

setFillSortKey(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillTranslate

Sets the fill-translate paint property for one or more layers.

setFillTranslate(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setFillTranslateAnchor

Sets the fill-translate-anchor paint property for one or more layers.

setFillTranslateAnchor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHeatmapColor

Sets the heatmap-color paint property for one or more layers.

setHeatmapColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHeatmapIntensity

Sets the heatmap-intensity paint property for one or more layers.

setHeatmapIntensity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHeatmapOpacity

Sets the heatmap-opacity paint property for one or more layers.

setHeatmapOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHeatmapRadius

Sets the heatmap-radius paint property for one or more layers.

setHeatmapRadius(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHeatmapWeight

Sets the heatmap-weight paint property for one or more layers.

setHeatmapWeight(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHillshadeAccentColor

Sets the hillshade-accent-color paint property for one or more layers.

setHillshadeAccentColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHillshadeExaggeration

Sets the hillshade-exaggeration paint property for one or more layers.

setHillshadeExaggeration(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHillshadeHighlightColor

Sets the hillshade-highlight-color paint property for one or more layers.

setHillshadeHighlightColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHillshadeIlluminationAnchor

Sets the hillshade-illumination-anchor paint property for one or more layers.

setHillshadeIlluminationAnchor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHillshadeIlluminationDirection

Sets the hillshade-illumination-direction paint property for one or more layers.

setHillshadeIlluminationDirection(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setHillshadeShadowColor

Sets the hillshade-shadow-color paint property for one or more layers.

setHillshadeShadowColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconAllowOverlap

Sets the icon-allow-overlap layout property for one or more layers.

setIconAllowOverlap(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconAnchor

Sets the icon-anchor layout property for one or more layers.

setIconAnchor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconColor

Sets the icon-color paint property for one or more layers.

setIconColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconHaloBlur

Sets the icon-halo-blur paint property for one or more layers.

setIconHaloBlur(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconHaloColor

Sets the icon-halo-color paint property for one or more layers.

setIconHaloColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconHaloWidth

Sets the icon-halo-width paint property for one or more layers.

setIconHaloWidth(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconIgnorePlacement

Sets the icon-ignore-placement layout property for one or more layers.

setIconIgnorePlacement(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconImage

Sets the icon-image layout property for one or more layers.

setIconImage(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconKeepUpright

Sets the icon-keep-upright layout property for one or more layers.

setIconKeepUpright(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconOffset

Sets the icon-offset layout property for one or more layers.

setIconOffset(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconOpacity

Sets the icon-opacity paint property for one or more layers.

setIconOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconOptional

Sets the icon-optional layout property for one or more layers.

setIconOptional(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconPadding

Sets the icon-padding layout property for one or more layers.

setIconPadding(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconPitchAlignment

Sets the icon-pitch-alignment layout property for one or more layers.

setIconPitchAlignment(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconRotate

Sets the icon-rotate layout property for one or more layers.

setIconRotate(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconRotationAlignment

Sets the icon-rotation-alignment layout property for one or more layers.

setIconRotationAlignment(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconSize

Sets the icon-size layout property for one or more layers.

setIconSize(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconTextFit

Sets the icon-text-fit layout property for one or more layers.

setIconTextFit(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconTextFitPadding

Sets the icon-text-fit-padding layout property for one or more layers.

setIconTextFitPadding(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconTranslate

Sets the icon-translate paint property for one or more layers.

setIconTranslate(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setIconTranslateAnchor

Sets the icon-translate-anchor paint property for one or more layers.

setIconTranslateAnchor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineBlur

Sets the line-blur paint property for one or more layers.

setLineBlur(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineCap

Sets the line-cap layout property for one or more layers.

setLineCap(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineColor

Sets the line-color paint property for one or more layers.

setLineColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineDasharray

Sets the line-dasharray paint property for one or more layers.

setLineDasharray(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineGapWidth

Sets the line-gap-width paint property for one or more layers.

setLineGapWidth(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineGradient

Sets the line-gradient paint property for one or more layers.

setLineGradient(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineJoin

Sets the line-join layout property for one or more layers.

setLineJoin(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineMiterLimit

Sets the line-miter-limit layout property for one or more layers.

setLineMiterLimit(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineOffset

Sets the line-offset paint property for one or more layers.

setLineOffset(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineOpacity

Sets the line-opacity paint property for one or more layers.

setLineOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLinePattern

Sets the line-pattern paint property for one or more layers.

setLinePattern(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineRoundLimit

Sets the line-round-limit layout property for one or more layers.

setLineRoundLimit(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineSortKey

Sets the line-sort-key layout property for one or more layers.

setLineSortKey(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineTranslate

Sets the line-translate paint property for one or more layers.

setLineTranslate(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineTranslateAnchor

Sets the line-translate-anchor paint property for one or more layers.

setLineTranslateAnchor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setLineWidth

Sets the line-width paint property for one or more layers.

setLineWidth(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setRasterBrightnessMax

Sets the raster-brightness-max paint property for one or more layers.

setRasterBrightnessMax(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setRasterBrightnessMin

Sets the raster-brightness-min paint property for one or more layers.

setRasterBrightnessMin(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setRasterContrast

Sets the raster-contrast paint property for one or more layers.

setRasterContrast(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setRasterFadeDuration

Sets the raster-fade-duration paint property for one or more layers.

setRasterFadeDuration(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setRasterHueRotate

Sets the raster-hue-rotate paint property for one or more layers.

setRasterHueRotate(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setRasterOpacity

Sets the raster-opacity paint property for one or more layers.

setRasterOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setRasterResampling

Sets the raster-resampling paint property for one or more layers.

setRasterResampling(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setRasterSaturation

Sets the raster-saturation paint property for one or more layers.

setRasterSaturation(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSkyAtmosphereColor

Sets the sky-atmosphere-color paint property for one or more layers.

setSkyAtmosphereColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSkyAtmosphereHaloColor

Sets the sky-atmosphere-halo-color paint property for one or more layers.

setSkyAtmosphereHaloColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSkyAtmosphereSun

Sets the sky-atmosphere-sun paint property for one or more layers.

setSkyAtmosphereSun(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSkyAtmosphereSunIntensity

Sets the sky-atmosphere-sun-intensity paint property for one or more layers.

setSkyAtmosphereSunIntensity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSkyGradient

Sets the sky-gradient paint property for one or more layers.

setSkyGradient(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSkyGradientCenter

Sets the sky-gradient-center paint property for one or more layers.

setSkyGradientCenter(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSkyGradientRadius

Sets the sky-gradient-radius paint property for one or more layers.

setSkyGradientRadius(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSkyOpacity

Sets the sky-opacity paint property for one or more layers.

setSkyOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSkyType

Sets the sky-type paint property for one or more layers.

setSkyType(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSymbolAvoidEdges

Sets the symbol-avoid-edges layout property for one or more layers.

setSymbolAvoidEdges(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSymbolPlacement

Sets the symbol-placement layout property for one or more layers.

setSymbolPlacement(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSymbolSortKey

Sets the symbol-sort-key layout property for one or more layers.

setSymbolSortKey(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSymbolSpacing

Sets the symbol-spacing layout property for one or more layers.

setSymbolSpacing(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setSymbolZOrder

Sets the symbol-z-order layout property for one or more layers.

setSymbolZOrder(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextAllowOverlap

Sets the text-allow-overlap layout property for one or more layers.

setTextAllowOverlap(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextAnchor

Sets the text-anchor layout property for one or more layers.

setTextAnchor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextColor

Sets the text-color paint property for one or more layers.

setTextColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextField

Sets the text-field layout property for one or more layers.

setTextField(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextFont

Sets the text-font layout property for one or more layers.

setTextFont(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextHaloBlur

Sets the text-halo-blur paint property for one or more layers.

setTextHaloBlur(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextHaloColor

Sets the text-halo-color paint property for one or more layers.

setTextHaloColor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextHaloWidth

Sets the text-halo-width paint property for one or more layers.

setTextHaloWidth(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextIgnorePlacement

Sets the text-ignore-placement layout property for one or more layers.

setTextIgnorePlacement(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextJustify

Sets the text-justify layout property for one or more layers.

setTextJustify(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextKeepUpright

Sets the text-keep-upright layout property for one or more layers.

setTextKeepUpright(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextLetterSpacing

Sets the text-letter-spacing layout property for one or more layers.

setTextLetterSpacing(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextLineHeight

Sets the text-line-height layout property for one or more layers.

setTextLineHeight(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextMaxAngle

Sets the text-max-angle layout property for one or more layers.

setTextMaxAngle(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextMaxWidth

Sets the text-max-width layout property for one or more layers.

setTextMaxWidth(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextOffset

Sets the text-offset layout property for one or more layers.

setTextOffset(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextOpacity

Sets the text-opacity paint property for one or more layers.

setTextOpacity(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextOptional

Sets the text-optional layout property for one or more layers.

setTextOptional(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextPadding

Sets the text-padding layout property for one or more layers.

setTextPadding(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextPitchAlignment

Sets the text-pitch-alignment layout property for one or more layers.

setTextPitchAlignment(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextRadialOffset

Sets the text-radial-offset layout property for one or more layers.

setTextRadialOffset(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextRotate

Sets the text-rotate layout property for one or more layers.

setTextRotate(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextRotationAlignment

Sets the text-rotation-alignment layout property for one or more layers.

setTextRotationAlignment(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextSize

Sets the text-size layout property for one or more layers.

setTextSize(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextTransform

Sets the text-transform layout property for one or more layers.

setTextTransform(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextTranslate

Sets the text-translate paint property for one or more layers.

setTextTranslate(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextTranslateAnchor

Sets the text-translate-anchor paint property for one or more layers.

setTextTranslateAnchor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextVariableAnchor

Sets the text-variable-anchor layout property for one or more layers.

setTextVariableAnchor(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setTextWritingMode

Sets the text-writing-mode layout property for one or more layers.

setTextWritingMode(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void

setVisibility

Sets the visibility layout property for one or more layers.

setVisibility(layer: LayerRef, value: any): void
Parameters
layer (LayerRef)
value (any)
Returns
void