A
A
Alex Kizyma2020-04-18 20:49:56
JavaScript
Alex Kizyma, 2020-04-18 20:49:56

Can't see the marker on Google maps?

<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDoLs4jh4_7ZW16LDVDAXDPGISWv9RN-x8&callback=initMap"
            async defer></script>
<script>
    function initMap() {
            var map = new google.maps.Map(document.getElementById('map'), {
                zoom: 9,
                center: {lat: 49.802875, lng: 24.000163},
                styles: [...]
            });
            setMarkers(map);
        }

        var beaches = [
            ['Sambir', 49.516293, 23.198340, 1]
        ];

        function setMarkers(map) {
            for (var i = 0; i < beaches.length; i++) {
                var beach = beaches[i];
                var marker = new google.maps.Marker({
                    position: {lat: beach[1], lng: beach[2]},
          animation: google.maps.Animation.DROP,
                    map: map,
                    icon: '/marker.png'
                });
            }
        }	
  
        
    </script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Boychenko, 2020-04-18
@vladislav_boychenko

You

{lat: ['Sambir', 49.516293, 23.198340, 1], lng: undefined}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question