MapType
Map type.
Constructor
MapType(name, layers)
Creates an instance of the map type.
Parameters:
Parameter |
Default value |
Description |
|
— |
Type: String Type name. |
— |
Type: Function[]|String[] Array containing constructors for layers or keys. |
* Mandatory parameter/option.
Example:
// Creating a custom map type that consists of satellite images from MapQuest
// with the Yandex.Hybrid overlay.
// Class of MapQuest tiles
var MQLayer = function () {
var layer = new ymaps.Layer('http://oatile%d.mqcdn.com/naip//%z/%x/%y.jpg');
// Copyrights
layer.getCopyrights = function () {
return ymaps.vow.resolve('Data, imagery and map information provided by MapQuest, Open Street Map and contributors, CC-BY-SA');
};
// Range of available zoom levels
layer.getZoomRange = function () {
return ymaps.vow.resolve([0, 18]);
};
return layer;
};
// Adding a layer with the key
ymaps.layer.storage.add('mq#aerial', MQLayer);
// Creating a map type that consists of the layers 'mq#aerial' and 'yandex#skeleton'
var myMapType = new ymaps.MapType('MQ + Ya', ['mq#aerial', 'yandex#skeleton']);
// Adding it to the map type storage
ymaps.mapType.storage.add('mq_ya#hybrid', myMapType);
// Now we can set our map type for any map
map.setType('mq_ya#hybrid');
Methods
Name |
Returns |
Description |
Function[]|String[] |
Returns a list of layers for the given map type - an array of constructors or keys for layers. |
|
getName() |
String |
Returns name of the map type. |
Methods details
getLayers
{Function[]|String[]} getLayers()
Returns a list of layers for the given map type - an array of constructors or keys for layers.
getName
{String} getName()
Returns name of the map type.
Parameters:
Parameter |
Default value |
Description |
|
— |
Type: |
* Mandatory parameter/option.
Mandatory parameter/option.
Was the article helpful?
Previous
Next