moveLayer(
id:string,beforeId?:string):this
Defined in: ui/map.ts:3559
Moves a layer to a different z-position.
Parameters
| Parameter | Type | Description |
|---|---|---|
id |
string |
The ID of the layer to move. |
beforeId? |
string |
The ID of an existing layer to insert the new layer before. When viewing the map, the id layer will appear beneath the beforeId layer. If beforeId is omitted, the layer will be appended to the end of the layers array and appear above all other layers on the map. |
Returns
this
Example
Move a layer with ID 'polygon' before the layer with ID 'country-label'. The polygon layer will appear beneath the country-label layer on the map.
map.moveLayer('polygon', 'country-label');