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 |
|
|
Value of input |
|
|
|
Optional object parameters. |
Inherited from
new YMapDefaultSchemeLayer(props, children?, options?)
Constructor parameters
|
Parameter |
Type |
|
|
|
|
|
|
|
|
|
Inherited from
Props
YMapDefaultSchemeLayerProps: Object
Parameters
|
Name |
Type |
Description |
|
|
|
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.
See example https://yandex.ru/dev/jsapi30/doc/ru/examples/cases/over-zoom
|
|
|
Vector tile customization. |
|
|
|
|
Layer parameters. |
|
|
|
Source name. |
|
|
|
Theme applied to the |
|
|
|
Show |
Methods
update
update(changedProps): void
Method of updating object props.
Parameters
|
Parameter |
Type |
Description |
|
|
New |
Returns
void