Layers
A style's layers property lists all the layers available in that style.
setLayer
Adds a FATOS style layer to the map's style.
Parameter
Required Parameter | Description | Type |
---|---|---|
id | A unique identifier that you define. | String |
source | The data source for the layer. Reference a source that has already been defined using the source's unique id. | String |
type | The type of layer (ex. fill or symbol) A list of layer types is available in the Style Specification | String |
Optional Parameter | Description | Type |
---|---|---|
filter | An expression specifying conditions on source features. Only features that match the filter are displayed. | Array |
minzoom | The minimum zoom level for the layer. | number |
maxzoom | The maximum zoom level for the layer. | number |
layout | Layout properties for the layer. Available layout properties vary by | Object |
paint | Paint properties for the layer. Available paint properties vary by A full list of paint properties for each layer type is available in the Style Specification | Object |
beforlayerID | The ID of an existing layer to insert the new layer before, resulting in the new layer appearing visually beneath the existing layer. | String |
Example
moveLayer
Moves a layer to a different z-position.
Parameter
Required Parameter | Description | Type |
---|---|---|
id | The ID of the layer to move. | String |
beforlayerID | The ID of an existing layer to insert the new layer before. When viewing the map, the | String |
Example
removeLayer
Removes the layer with the given ID from the map's style.
Parameter
Required Parameter | Description | Type |
---|---|---|
id | ID of the layer to remove. | String |
Example
getLayer
Returns the layer with the specified ID in the map's style.
Parameter
Required Parameter | Description | Type |
---|---|---|
id | The ID of the layer to get. | String |
Example
setFilter
Sets the filter for the specified style layer.
Parameter
Required Parameter | Description | Type |
---|---|---|
layerId | The ID of the layer to which the filter will be applied. | String |
filter | Filters control which features a style layer renders from its source. | Array | null |
Example
getFilter
Returns the filter applied to the specified style layer.
Parameter
Required Parameter | Description | Type |
---|---|---|
layerId | The ID of the style layer whose filter to get. | String |
Example
setPaintProperty
Returns the filter applied to the specified style layer.
Parameter
Required Parameter | Description | Type |
---|---|---|
layerId | The ID of the layer to set the paint property in. | String |
name | The name of the paint property to set. | String |
value | The value of the paint property to set. Must be of a type appropriate for the property | any |
Example
getPaintProperty
Returns the value of a paint property in the specified style layer.
Parameter
Required Parameter | Description | Type |
---|---|---|
layerId | The ID of the layer to get the paint property from. | String |
name | The name of the paint property to set. | String |
Example
setLayoutProperty
Sets the value of a layout property in the specified style layer.
Parameter
Required Parameter | Description | Type |
---|---|---|
layerId | The ID of the layer to set the layout property in. | String |
name | The name of the layout property to set. | String |
value | The value of the layout property. Must be of a type appropriate for the property | any |
Example
getLayoutProperty
Returns the value of a layout property in the specified style layer.
Parameter
Required Parameter | Description | Type |
---|---|---|
layerId | TThe ID of the layer to get the layout property from. | String |
name | The name of the layout property to get. | String |
Example
Last updated