Skip to content

Instantly share code, notes, and snippets.

@reaferon
Last active May 28, 2019 19:55
Show Gist options
  • Select an option

  • Save reaferon/9bc05c7143f8fe30b6028bab681c2ee9 to your computer and use it in GitHub Desktop.

Select an option

Save reaferon/9bc05c7143f8fe30b6028bab681c2ee9 to your computer and use it in GitHub Desktop.

Revisions

  1. reaferon revised this gist May 28, 2019. No changes.
  2. reaferon renamed this gist May 28, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. reaferon created this gist May 28, 2019.
    62 changes: 62 additions & 0 deletions map
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,62 @@
    ymaps.ready(init);

    function init() {
    var myMap = new ymaps.Map("map", {
    center: [55.76, 37.64],
    zoom: 10
    }),

    // Создаем геообъект с типом геометрии "Точка".
    myGeoObject = new ymaps.GeoObject({
    // Описание геометрии.
    geometry: {
    type: "Point",
    coordinates: [55.8, 37.8]
    },
    // Свойства.
    properties: {
    // Контент метки.
    iconContent: 'Метка',
    balloonContent: 'Меня можно перемещать'
    }
    }, {
    // Опции.
    // Иконка метки будет растягиваться под размер ее содержимого.
    preset: 'twirl#redStretchyIcon',
    // Метку можно перемещать.
    draggable: true
    }),

    // Создаем метку с помощью вспомогательного класса.
    myPlacemark1 = new ymaps.Placemark([55.8, 37.6], {
    // Свойства.
    // Содержимое иконки, балуна и хинта.
    iconContent: '1',
    balloonContent: 'Балун',
    hintContent: 'Стандартный значок метки'
    }, {
    // Опции.
    // Стандартная фиолетовая иконка.
    preset: 'twirl#violetIcon'
    }),

    myPlacemark2 = new ymaps.Placemark([55.76, 37.56], {
    // Свойства.
    hintContent: 'Собственный значок метки'
    }, {
    // Опции.
    // Своё изображение иконки метки.
    iconImageHref: '/maps/doc/jsapi/2.x/examples/images/myIcon.gif',
    // Размеры метки.
    iconImageSize: [30, 42],
    // Смещение левого верхнего угла иконки относительно
    // её "ножки" (точки привязки).
    iconImageOffset: [-3, -42]
    });

    //myMap.controls.add('smallZoomControl');
    // Добавляем все метки на карту.
    myMap.geoObjects.add(myPlacemark1)
    .add(myPlacemark2)
    .add(myGeoObject);
    }