SourceManager interface

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

Methods

add(Source | Source[])

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

clear()

Removes all sources from the map.

getById(string)

Retrieves a source with the specified id.

getFeatureState(string | Shape | Feature<atlas.data.Geometry, any>, string | Source, string)

Gets the state of a feature

getRenderedShapes(string | Source, Expression, string)

Returns all rendered shape features in a source that match a specified filter. If the source is a vector tile source, a source layer name needs to be specified.

getSources()

Retrieves all sources that have been added to the map.

isSourceLoaded(string | Source)

Returns a boolean indicating if the source is loaded or not.

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

Removes one or more sources from the map by specifying the source id or providing the source itself.

removeFeatureState(string | Shape | Feature<atlas.data.Geometry, any>, string | Source, string, string)

Removes the state or a single key value of the state of a feature.

setFeatureState(string | Shape | Feature<atlas.data.Geometry, any>, string | Source, object, string)

Sets the state of the feature by passing in a key value pair object.

Method Details

add(Source | Source[])

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

function add(source: Source | Source[])

Parameters

source

Source | Source[]

clear()

Removes all sources from the map.

function clear()

getById(string)

Retrieves a source with the specified id.

function getById(id: string): Source

Parameters

id

string

Returns

getFeatureState(string | Shape | Feature<atlas.data.Geometry, any>, string | Source, string)

Gets the state of a feature

function getFeatureState(feature: string | Shape | Feature<atlas.data.Geometry, any>, source: string | Source, sourceLayer?: string): object

Parameters

feature

string | Shape | Feature<Geometry, any>

the ID of the feature

source

string | Source

the ID of the source

sourceLayer

string

the ID of the layer

Returns

object

getRenderedShapes(string | Source, Expression, string)

Returns all rendered shape features in a source that match a specified filter. If the source is a vector tile source, a source layer name needs to be specified.

function getRenderedShapes(source: string | Source, filter?: Expression, sourceLayer?: string): Array<Feature<atlas.data.Geometry, any> | Shape>

Parameters

source

string | Source

source to be queried

filter
Expression

a filter to limit the query

sourceLayer

string

the layer where shapes and features are matched

Returns

Array<Feature<Geometry, any> | Shape>

getSources()

Retrieves all sources that have been added to the map.

function getSources(): Source[]

Returns

Source[]

isSourceLoaded(string | Source)

Returns a boolean indicating if the source is loaded or not.

function isSourceLoaded(source: string | Source): boolean

Parameters

source

string | Source

The id of a source or a Source object.

Returns

boolean

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

Removes one or more sources from the map by specifying the source id or providing the source itself.

function remove(source: string | Source | Array<string | Source>)

Parameters

source

string | Source | Array<string | Source>

removeFeatureState(string | Shape | Feature<atlas.data.Geometry, any>, string | Source, string, string)

Removes the state or a single key value of the state of a feature.

function removeFeatureState(feature: string | Shape | Feature<atlas.data.Geometry, any>, source: string | Source, sourceLayer?: string, key?: string)

Parameters

feature

string | Shape | Feature<Geometry, any>

the ID of the feature

source

string | Source

the ID of the source

sourceLayer

string

the ID of the layer

key

string

the key in the feature state to update

setFeatureState(string | Shape | Feature<atlas.data.Geometry, any>, string | Source, object, string)

Sets the state of the feature by passing in a key value pair object.

function setFeatureState(feature: string | Shape | Feature<atlas.data.Geometry, any>, source: string | Source, state: object, sourceLayer?: string)

Parameters

feature

string | Shape | Feature<Geometry, any>

the ID of the feature

source

string | Source

the ID of the source

state

object

sourceLayer

string

the ID of the layer