JSFiddle - React, Tailwind, and code Playground
by zloylos
HTML
<script src="//api-maps.yandex.ru/2.1-dev/?&lang=ru-RU" type="text/javascript"></script>
<div id="mapContainer" style="width:400px; height:300px"></div>
JavaScript
var myMap;
function init () {
myMap = new ymaps.Map('mapContainer', {
center: [55.75, 37.63],
zoom: 14,
controls: []
});
// Создаем коллекцию.
var myCollection = new ymaps.GeoObjectCollection(),
// Создаем массив с данными.
myPoints = [
{ coords: [55.77, 37.46], text: 'Трактир' },
{ coords: [55.66, 37.48], text: 'Кафе' },
{ coords: [55.65, 37.42], text: 'Ресторан' },
{ coords: [55.64, 37.54], text: 'Музей' },
{ coords: [55.54, 37.52], text: 'Библиотека' },
{ coords: [55.53, 37.56], text: 'Школа' },
{ coords: [55.61, 37.61], text: 'Аптека' },
{ coords: [55.80, 37.58], text: 'Бар' },
{ coords: [55.71, 37.35], text: 'Институт' },
{ coords: [55.74, 37.57], text: 'Университет' },
{ coords: [55.58, 37.69], text: 'Больница' },
{ coords: [55.57, 37.70], text: 'Цирк' },
{ coords: [55.55, 37.64], text: 'Магазин' },
{ coords: [55.50, 37.75], text: 'Булочная' },
{ coords: [55.81, 37.73], text: 'Полиция' },
{ coords: [55.73, 37.68], text: 'Салон красоты' },
{ coords: [55.75, 37.64], text: 'Салон красоты' },
{ coords: [55.86, 37.76], text: 'Баня' },
{ coords: [55.38, 37.69], text: 'Гараж' },
{ coords: [55.91, 37.50], text: 'Дом' },
{ coords: [55.62, 37.32], text: 'Прачечная' },
{ coords: [55.85, 37.41], text: 'Стадион' },
{ coords: [55.67, 37.24], text: 'Вокзал' }
];
// Добавляем коллекцию меток на карту.
myMap.geoObjects.add(myCollection);
// Заполняем коллекцию данными.
myPoints.forEach(function (point) {
myCollection.add(new ymaps.Placemark(
...