Filters

setFilter

map.setFilter(layerId, filter);

Parameters

Parameter (Required)
Description
Remark

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

Returns

Parameter
Description
Remark

Example

// display only features with the 'name' property 'USA'
map.setFilter('my-layer', ['==', ['get', 'name'], 'USA']);
// remove the filter for the 'my-layer' style layer
map.setFilter('my-layer', null);

getFilter

map.getFilter(layerId);

Parameters

Parameter (Required)
Description
Remark

layerID

The ID of the style layer whose filter to get.

String

Returns

Parameter
Description
Remark

Example

const filter = map.getFilter('myLayer');e

moveLayer

map.moveLayer(id, beforlayerID)

Parameters

Parameter (Required)
Description
Remark

id

The ID of the layer to move.

String

beforeLayerID

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.

String

Returns

Parameter
Description
Remark

Example

map.moveLayer('3d_building-kor', 'landuse');

removeLayer

map.removeLayer(id);p

Parameters

Parameter (Required)
Description
Remark

id

ID of the layer to remove.

String

Returns

Parameter
Description
Type

Example

// Some code

The MOGOS Maps API requires an API Key, which can be obtained from the MOGOS Console website or contact [email protected].

Last updated