D
D
danilr2019-06-11 15:51:46
JavaScript
danilr, 2019-06-11 15:51:46

Why is the marker not displayed as an image in 2GIS?

I'm trying to set a marker with a picture like this in the documentation (only the picture is a link there, but I have a static one in the folder)
Why doesn't it work?

var map;
    
        DG.then(function () {
            map = DG.map('map', {
                center: [55.016595, 82.948391],
                zoom: 17,
                zoomControl: false,
          minZoom: 11,
          fullscreenControl: false
            });
            myDivIcon = DG.divIcon({
                iconUrl: './img/marker.svg',
                    iconSize: [45, 70],
                    // className: "marker-custom",
                    // html: '<img class="marker-img" src="img/marker.svg">'
                    
                });
                DG.marker([55.016595, 82.948391], {
                    icon: myDivIcon
                }).addTo(map);
        });

if you do it through html, it turns out crooked - the marker itself is larger than the picture (i.e. you can press on the void around the marker)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question