L.Yandex
July 10, 2019 ยท View on GitHub
A Leaflet basemap provider based on Yandex.Maps JS API 2.1.
L.Yandex extends L.Layer.
API
Usage example
L.yandex('yandex#satellite').addTo(map);
Creation
Factory: L.yandex(<String> type?, <Object> options?)
Instantiates a Yandex layer object given type and options arguments (both optional).
Can be used with single options argument, if it contains type property.
Map types
-
Valid basemap types:
yandex#map,yandex#satellite,yandex#hybrid,yandex#map~vectoror their short names:map,satellite,hybrid,map~vector. -
Valid overlay types:
overlay- empty transparent map, which can be used for displaying data provided e.g. by controls.skeleton- roads and labels, like inhybrid(but w/o basemap).
Options
| Option | Type | Default | Description |
|---|---|---|---|
type | String | 'yandex#map' | The same as type argument. |
mapOptions | Object | (see in the sources) | Options to set on map creation. |
overlayOpacity | Number | 0.8 | Opacity used for overlay map types. |
opacity | Number | undefined | Force map opacity to given value. Not really useful, but kept for compatibility. |
Note, that traffic option removed, as traffic layer can be added using ymaps JSAPI directly. See Examples and Addons sections of this documentation.
Events
load: Fired after Yandex map object is initialized.
Data: Event
Examples
-
yandex.html: basic usage, incl. traffic layer sample.
-
yandex-controls.html: adds some Yandex controls (incl. trafficControl), via ymaps JSAPI.
-
yandex-kml-gpx.html: uses
geoXmlymaps API to load KML/GPX.
Addons
'Addons' are optional scripts adding some custom functionality to main class.
Should be loaded after Yandex.js.
Addons can add own api (options, methods, etc), that is described in their source files' comments.
-
It's purpose is dynamic/deferred runtime API enabling.
-
This addon allows using of Yandex controls just specifying them in options, without direct ymaps JSAPI calls.
See yandex-addon-controls.html (functionality is the same as in yandex-controls.html).
-
Purpose: to integrate panoramas player with leaflet map, avoiding controls conflicts. It's function is to take player out of map and put it into separate element.
-
Purpose: enable standard Yandex map controls/behaviors in fullscreen.