MMapDefaultSchemeLayer

The MMapDefaultSchemeLayer class is a visual component that loads map scheme data from some source and adds it to the map.

Depending on the layers parameter, a layer can display:

  • ground: The whole raster map scheme and the vector ground layer.
  • buildings: The building vector layer.
  • icons: The icon vector layer.
  • labels: The label vector layer.

Creating a layer

For example, this code will load the data and add a raster scheme layer to the map:

const schema = new MMapDefaultSchemeLayer({type: 'ground'});

map.addChild(schema);

This code will load the data and add all scheme layers with all data sources to the map:

const schema = new MMapDefaultSchemeLayer({theme: 'light'});

map.addChild(schema);

Note

In this example, the layer constructor receives only the color theme as input, and the other parameters are taken from MMapDefaultSchemeLayer.defaultProps by default

Creating a layer with selected schemes

The MMapDefaultSchemeLayer class can be used only as a data loader so that the loaded data can be displayed selectively using MMapLayer:

// Initialize invisible MMapDefaultSchemeLayer.
// It is hidden because it is only used to load data.
const schema = MMapDefaultSchemeLayer({theme: 'light', visible: false, source: 'scheme'});

// Add it to the map.
map.addChild(schema);

// Then add a couple MMapLayer's to the map, specifying for each of them
// which data from MMapDefaultSchemeLayer to display.
map.addChild(new MMapLayer({zIndex: 1, source: 'scheme', type: 'ground'}))
map.addChild(new MMapLayer({zIndex: 2, source: 'scheme', type: 'labels'}))
map.addChild(new MMapLayer({zIndex: 3, source: 'scheme', type: 'buildings'}))
map.addChild(new MMapLayer({zIndex: 4, source: 'scheme', type: 'icons'}))

Constructor

new MMapDefaultSchemeLayer(props, options?)

Constructor parameters

Parameter

Type

Description

props

MMapDefaultSchemeLayerProps

Value of input props.

options

ComplexOptions<MMap>

Optional object parameters.

Inherited from

MMapComplexEntity.constructor

new MMapDefaultSchemeLayer(props, children?, options?)

Constructor parameters

Parameter

Type

props

MMapDefaultSchemeLayerProps

children?

GenericEntity<unknown, {}, MMap>[]

options?

Omit<ComplexOptions<MMap>, "children">

Inherited from

MMapComplexEntity.constructor

Props

MMapDefaultSchemeLayerProps: Object

Parameters

Name

Type

Description

clampMapZoom?

boolean

Allows map scale limiting. If you want the layer scale not to lock when the maximum value is reached, you can set this field to false. You may need this, for example, when your custom layers run at a zoom larger than 21.

const defaultSchemeLayer = new MMapDefaultSchemeLayer({clampMapZoom: false}); map.addChild(defaultSchemeLayer);

See example https://mappable.world/docs/js-api/examples/cases/over-zoom.html Default

true

customization?

VectorCustomization

Vector tile customization.

layers?

Partial<Record<MMapDefaultSchemeLayerType, Partial<MMapLayerProps>>>

Layer parameters.

source?

string

Source name.

theme?

"dark" | "light"

Theme applied to the Deprecated scheme use MMapProps instead the prop theme in MMap

visible?

boolean

Show Deprecated layers, using MMapDefaultSchemeLayerProps layers instead of them.

Methods

update

update(changedProps): void

Method of updating object props.

Parameters

Parameter

Type

Description

changedProps

Partial<MMapDefaultSchemeLayerProps>

New props values.

Returns

void

Inherited from

MMapComplexEntity.update