YMapDefaultSchemeLayer

The YMapDefaultSchemeLayer 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 YMapDefaultSchemeLayer({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 YMapDefaultSchemeLayer({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 YMapDefaultSchemeLayer.defaultProps by default

Creating a layer with selected schemes

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

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

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

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

Constructor

new YMapDefaultSchemeLayer(props, options?)

Constructor parameters

Parameter

Type

Description

props

YMapDefaultSchemeLayerProps

Value of input props.

options

ComplexOptions<YMap>

Optional object parameters.

Inherited from

YMapComplexEntity.constructor

new YMapDefaultSchemeLayer(props, children?, options?)

Constructor parameters

Parameter

Type

props

YMapDefaultSchemeLayerProps

children?

GenericEntity<unknown, {}, YMap>[]

options?

Omit<ComplexOptions<YMap>, "children">

Inherited from

YMapComplexEntity.constructor

Props

YMapDefaultSchemeLayerProps: 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 YMapDefaultSchemeLayer({clampMapZoom: false}); map.addChild(defaultSchemeLayer);

See example https://yandex.ru/dev/jsapi30/doc/ru/examples/cases/over-zoom Default

true

customization?

VectorCustomization

Vector tile customization.

layers?

Partial<Record<YMapDefaultSchemeLayerType, Partial<YMapLayerProps>>>

Layer parameters.

source?

string

Source name.

theme?

"dark" | "light"

Theme applied to the Deprecated scheme use YMapProps instead the prop theme in YMap

visible?

boolean

Show Deprecated layers, using YMapDefaultSchemeLayerProps layers instead of them.

Methods

update

update(changedProps): void

Method of updating object props.

Parameters

Parameter

Type

Description

changedProps

Partial<YMapDefaultSchemeLayerProps>

New props values.

Returns

void

Inherited from

YMapComplexEntity.update