Layers

setLayer

map.setLayer(layer,id,source,type,filter,minzoom,maxzoom,layout,paint,beforelayerid);

Parameters

Parameter (Required)
Description
Remark

layer

The layer to add.

Object

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 style of layer (ex. fill or symbol).

please refer to The specification of layer style.

String

Parameter (Optional)
Description
Remark

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.

Numeric

maxZoom

The maximum zoom level for the layer.

Numeric

layout

Layout properties for the layer Available layout properties vary by layer.type.

Object

paint

Paint properties for the layer

Available paint properties vary by layer.type.

Object

beforeLayerID

The ID of an existing layer to insert the new layer before, resulting in the new layer appearing visually beneath the existing layer.

String

Returns

Parameter
Description
Remark

Example

map.setLayer({
    id: 'some Layer ID',
    // References the GeoJSON source defined above
    // and does not require a `source-layer`
    source: 'some Source ID',
    //Style Specification
    type: 'symbol',
    layout: {
        // Set the label content to the
        // feature's `name` property
        'text-field': ['get', 'name'] //or String
    }
    paint: {
        'text-color' : '#000000'
    }
});

getLayer

map.getLayer(id);

Parameters

Parameter (Required)
Description
Remark

id

The ID of the layer to get.

String

Returns

Parameter
Description
Remark

Example

const stateDataLayer = map.getLayer('3d_building-kor');

type

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);

Parameters

Parameter (Required)
Description
Remark

id

ID of the layer to remove.

String

Returns

Parameter
Description
Remark

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