Скажите мне, если у вас есть вопросы.

я есть база мест с адресами, и я хочу добавить маркеры на Google Maps.

Он показывает только маркер по умолчанию, похоже, что geocoder.geocode () ничего не делает. Например, я пытаюсь добавить маркер «Нью-Йорк Сити», но безуспешно.

<script>
    var geocoder;
    var map;
    var address = "new york city";
    geocoder = new google.maps.Geocoder();
    function initMap() {
        var uluru = { lat: -25.363, lng: 131.044 };
        var map = new google.maps.Map(document.getElementById('map'), {
            zoom: 4,
            center: uluru
        });
        var marker = new google.maps.Marker({
            position: uluru,
            map: map
        });
        codeAddress(address);

    }

    function codeAddress(address) {

        geocoder.geocode({ 'address': address }, function (results, status) {
            if (status == 'OK') {
                    var marker = new google.maps.Marker({
                    position: address,
                    map: map
                });
            } else {
                alert('Geocode was not successful for the following reason: ' + status);
            }
        });
    }


</script>
<script src="https://maps.googleapis.com/maps/api/js?key=XXX&callback=initMap"
    async defer></script>

Ответы на вопрос(1)

Ваш ответ на вопрос