leaflet-plugins
Version:
Miscellaneous plugins for Leaflet library for services that need to display route information and need satellite imagery from different providers
32 lines (25 loc) • 845 B
HTML
<html>
<head>
<title>L.Yandex LoadApi (addon) promise example</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
<script src="../layer/tile/Yandex.js"></script>
<script src="../layer/tile/Yandex.addon.LoadApi.js"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script>
var map = L.map('map', {
center: [67.6755, 33.936],
zoom: 10,
attributionControl: false
});
var promise = $.getScript('https://api-maps.yandex.ru/2.1/?lang=en_RU&apikey=<your API-key>');
L.control.layers({
'Yandex': L.yandex({ apiLoader: promise }).addTo(map),
'Yandex Hybrid': L.yandex('hybrid')
}).addTo(map);
</script>
</body>
</html>