Клуб API Карт

Кластеризация и свои иконки

inity2010
30 июня 2016, 00:51

Не могу понять почему не показывает мои иконки сам скрипт

<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button><h3 id="myModalLabel">Магазины Novus Киев</h3></div><script async type="text/javascript">

ymaps.ready(function () {

    var myMap = new ymaps.Map('map', {

            center: [49.98, 31.53],

            zoom: 6,

            controls: []

        }),

        clusterer = new ymaps.Clusterer({

            preset: 'islands#invertedVioletClusterIcons',

            groupByCoordinates: true,

            clusterDisableClickZoom: true,

            clusterHideIconOnBalloonOpen: true,

            geoObjectHideIconOnBalloonOpen: true

        }),

            getPointData = function (index,address,id) {

            return {

                balloonContentBody: address +'<br><a target="_blank" href="http://top-shops.biz/shops/novus/'+ id +'.html">Подробнее</a>',

                clusterCaption: '<strong>' + address + '</strong>'

            };

        },

            getPointOptions = function () {

            return {

iconImageHref: 'http://top-shops.biz/favicon/favicon-16x16.png',

iconImageSize: [30, 42],

        iconImageOffset: [-3, -42]

                            

						

                

            };

        },

        points = [

            [50.410922, 30.626008],[50.49757, 30.366728],[50.393631, 30.611578],[50.458698, 30.63234],[50.505215, 30.498554],[50.461558, 30.355487],[50.453113, 30.59388],[50.468444, 30.601831],[50.438067, 30.621768],[50.406206, 30.398118],[50.386832, 30.472314],[50.414121, 30.538947],[50.42286, 30.464385],[50.505535, 30.458185],[50.466867, 30.654818],[50.411266, 30.605911],[50.407133, 30.610571],[50.389538, 30.625756],[50.454991, 30.388113],[50.453481, 30.366512]

        ],

        geoObjects = [];

        var names = ["\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432","\u041a\u0438\u0435\u0432"];

        var address = ["\u043f\u0440\u043e\u0441\u043f\u0435\u043a\u0442 \u041f\u0435\u0442\u0440\u0430 \u0413\u0440\u0438\u0433\u043e\u0440\u0435\u043d\u043a\u0430, 18","\u043f\u043b\u043e\u0449\u0430\u0434\u044c \u0413\u043e\u0441\u0442\u043e\u043c\u0435\u043b\u044c\u0441\u043a\u0430\u044f, 1","\u043f\u0440\u043e\u0441\u043f\u0435\u043a\u0442 \u0411\u0430\u0436\u0430\u043d\u0430 \u041d\u0438\u043a\u043e\u043b\u0430\u044f, 8","\u0443\u043b\u0438\u0446\u0430 \u0413\u043d\u0430\u0442\u0430 \u0425\u043e\u0442\u043a\u0435\u0432\u0438\u0447\u0430, 1\u0410","\u043f\u0440\u043e\u0441\u043f\u0435\u043a\u0442 \u041e\u0431\u043e\u043b\u043e\u043d\u0441\u043a\u0438\u0439, 1\u0411","\u043f\u0440\u043e\u0441\u043f\u0435\u043a\u0442 \u0410\u043a\u0430\u0434\u0435\u043c\u0438\u043a\u0430 \u041f\u0430\u043b\u043b\u0430\u0434\u0438\u043d\u0430, 7\u0410","\u043f\u0440\u043e\u0441\u043f\u0435\u043a\u0442 \u0411\u0440\u043e\u0432\u0430\u0440\u0441\u043a\u043e\u0439, 17","\u0443\u043b\u0438\u0446\u0430 \u0412\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u0441\u043a\u0430\u044f, 14\u0410","\u0443\u043b\u0438\u0446\u0430 \u0420\u0435\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043d\u0430\u044f, 4\u0410","\u041a\u043e\u043b\u044c\u0446\u0435\u0432\u0430\u044f \u0434\u043e\u0440\u043e\u0433\u0430, 12","\u0443\u043b\u0438\u0446\u0430 \u041c\u0438\u0445\u0430\u0438\u043b\u0430 \u041b\u043e\u043c\u043e\u043d\u043e\u0441\u043e\u0432\u0430, 73\u0410","\u0431\u0443\u043b\u044c\u0432\u0430\u0440 \u0414\u0440\u0443\u0436\u0431\u044b \u041d\u0430\u0440\u043e\u0434\u043e\u0432, 16\u0410","\u043f\u0440\u043e\u0441\u043f\u0435\u043a\u0442 \u0412\u0430\u043b\u0435\u0440\u0438\u044f \u041b\u043e\u0431\u0430\u043d\u043e\u0432\u0441\u043a\u043e\u0433\u043e, 4\u0414","\u0443\u043b\u0438\u0446\u0430 \u0418\u0432\u0430\u0448\u043a\u0435\u0432\u0438\u0447\u0430, 5","\u043f\u0440\u043e\u0441\u043f\u0435\u043a\u0442 \u0411\u0440\u043e\u0432\u0430\u0440\u0441\u043a\u043e\u0439, 18\u0414","\u0443\u043b\u0438\u0446\u0430 \u0417\u0434\u043e\u043b\u0431\u0443\u043d\u043e\u0432\u0441\u043a\u0430\u044f, 7\u0413","\u0414\u043d\u0435\u043f\u0440\u043e\u0432\u0441\u043a\u0430\u044f \u041d\u0430\u0431\u0435\u0440\u0435\u0436\u043d\u0430\u044f, 17\u0410","\u0443\u043b\u0438\u0446\u0430 \u0421\u043e\u0444\u0438\u0438 \u0420\u0443\u0441\u043e\u0432\u043e\u0439, 1\u0410","\u0443\u043b\u0438\u0446\u0430 \u0421\u0432\u044f\u0442\u043e\u0448\u0438\u043d\u0441\u043a\u0430\u044f, 3","\u0443\u043b\u0438\u0446\u0430 \u041b\u044c\u0432\u043e\u0432\u0441\u043a\u0430\u044f, 17"];

        var id = ["50-410922-30-626008","50-49757-30-366728","50-393631-30-611578","50-458698-30-63234","50-505215-30-498554","50-461558-30-355487","50-453113-30-59388","50-468444-30-601831","50-438067-30-621768","50-406206-30-398118","50-386832-30-472314","50-414121-30-538947","50-42286-30-464385","50-505535-30-458185","50-466867-30-654818","50-411266-30-605911","50-407133-30-610571","50-389538-30-625756","50-454991-30-388113","50-453481-30-366512"];

        for(var i = 0, len = points.length; i < len; i++) {

        geoObjects[i] = new ymaps.Placemark(points[i], getPointData(names[i],address[i],id[i]), getPointOptions());

    }

    clusterer.options.set({

        gridSize: 80,

        clusterDisableClickZoom: true

    });

    clusterer.add(geoObjects);

    myMap.geoObjects.add(clusterer);

    myMap.setBounds(clusterer.getBounds(), {

        checkZoomRange: true

    });

});

</script><div id="map" style="max-width: 760px; min-width: 120px; position: relative; min-height: 350px;max-height: 450px;"></div>

пробывал и относительный путь

iconImageHref: '/favicon/favicon-16x16.png'

все равно не показывает - что не так?

4 комментария
Подписаться на комментарии к посту
Соберите, пожалуйста, пример на jsfiddle.
ymapsapi,
собрал вот - https://jsfiddle.net/x3Lvn55w/
inity2010,
Вы забыли указать опцию iconLayout: 'default#image'.
Arina,
спасибо за подсказку...