LayerManager interface

A manager for the map control's layers. Exposed through the layers property of the atlas.Map class. Cannot be instantiated by the user.

Methods

add(Layer | Layer[], string | Layer)

Adds one or more layers to the map. The map must be ready before a layer can be added. Use the map.events.add method with event type 'ready'.

clear()

Removes all layers from the map.

getLayerById(string)

Retrieves a layer with the specified id.

getLayers()

Retrieves all layers that have been added to the map.

getRenderedShapes(Position | Point | BoundingBox, string | Layer | Array<string | Layer>, Expression)

Retrieve all Shapes and GeoJSON features that are visible on the map that are in a DataSource or VectorTileSource. Shape objects are editable, while Feature objects are not editable and either reside in a VectorTileSource or represent a cluster point. Clusters have the following properties:

cluster: `boolean` - Indicates that the point is a cluster. This will be set to true if Point object represents a cluster. All other point objects are unlikely to have this value unless a property with this same name was added to the Point property data from your app.

cluster_id: `string` - A unique id for the cluster.

point_count: `number` - The number of points inside the cluster.

point_count_abbreviated: `string` - An abbreviated string version of the point count. i.e. `"10K"`

Features/Shapes that are not visible or who's layer zoom range does not include the current zoom level will not be returned. Symbol features/Shapes that have been hidden due to text or icon collisions are not included. Features/Shapes from all other layers are included even if they have no contribution to the map rendering, e.g. alpha set to zero. The topmost rendered features/shapes appears first in the returned array and subsequent features are sorted in descending z-order.
move(string | Layer, string | Layer)

Moves a layer to a different z-position.

remove(string | Layer | Array<string | Layer>)

Removes one or more layers from the map.

Method Details

add(Layer | Layer[], string | Layer)

Adds one or more layers to the map. The map must be ready before a layer can be added. Use the map.events.add method with event type 'ready'.

function add(layer: Layer | Layer[], before?: string | Layer)

Parameters

layer

Layer | Layer[]

The layer(s) to add.

before

string | Layer

Optionally specify a layer or layer id to insert the new layer(s) before it.

clear()

Removes all layers from the map.

function clear()

getLayerById(string)

Retrieves a layer with the specified id.

function getLayerById(id: string): Layer

Parameters

id

string

The id of the layer to retrieve.

Returns

getLayers()

Retrieves all layers that have been added to the map.

function getLayers(): Layer[]

Returns

Layer[]

getRenderedShapes(Position | Point | BoundingBox, string | Layer | Array<string | Layer>, Expression)

Retrieve all Shapes and GeoJSON features that are visible on the map that are in a DataSource or VectorTileSource. Shape objects are editable, while Feature objects are not editable and either reside in a VectorTileSource or represent a cluster point. Clusters have the following properties:

cluster: `boolean` - Indicates that the point is a cluster. This will be set to true if Point object represents a cluster. All other point objects are unlikely to have this value unless a property with this same name was added to the Point property data from your app.

cluster_id: `string` - A unique id for the cluster.

point_count: `number` - The number of points inside the cluster.

point_count_abbreviated: `string` - An abbreviated string version of the point count. i.e. `"10K"`

Features/Shapes that are not visible or who's layer zoom range does not include the current zoom level will not be returned. Symbol features/Shapes that have been hidden due to text or icon collisions are not included. Features/Shapes from all other layers are included even if they have no contribution to the map rendering, e.g. alpha set to zero. The topmost rendered features/shapes appears first in the returned array and subsequent features are sorted in descending z-order.
function getRenderedShapes(geometry?: Position | Point | BoundingBox, layers?: string | Layer | Array<string | Layer>, filter?: Expression): Array<Shape | Feature<atlas.data.Geometry, any>>

Parameters

geometry

Position | Point | BoundingBox

A Position, Point, or BoundingBox that returned features must intersect. If not specified the whole visible world is used.

layers

string | Layer | Array<string | Layer>

An array of layers or their ids to limit the query to.

filter
Expression

A expression to filter the returned features by.

Returns

Array<Shape | Feature<Geometry, any>>

move(string | Layer, string | Layer)

Moves a layer to a different z-position.

function move(layer: string | Layer, before?: string | Layer)

Parameters

layer

string | Layer

The layer or id of the layer to move.

before

string | Layer

Optionally specify to move the layer before this.

remove(string | Layer | Array<string | Layer>)

Removes one or more layers from the map.

function remove(layer: string | Layer | Array<string | Layer>)

Parameters

layer

string | Layer | Array<string | Layer>

One or more layers or their ids for removal.