Uncaught (in promise) TypeError: e.getDraggable is not a function

Viewed 1129

I am doing a map with google maps but I have this error

markerclusterer.ts:818 Uncaught (in promise) TypeError: e.getDraggable is not a function
    at r.value (markerclusterer.ts:818)
    at r.value (markerclusterer.ts:801)
    at new r (markerclusterer.ts:345)
    at initMap (VM2170 map:82)
    at js?key=&callback=initMap:142
    at js?key=&callback=initMap:142

I get the cities from my database and I use the api google geocoder.geodecode to get coordinates from the cities. Ater that I use markercluster to make clusters but it doesn't work. I think it is because it expects another format than the one given by geodecode.

function initMap() {

        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 5,
          center: {lat: 48.856614, lng: 2.3522219}

        });
        map.setOptions({draggable: true});
        // Create an array of alphabetical characters used to label the markers.
        var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

        // Add some markers to the map.
        // Note: The code uses the JavaScript Array.prototype.map() method to
        // create an array of markers based on a given "locations" array.
        // The map() method here has nothing to do with the Google Maps API.
        //var markers = locations.map(function(location) {
        //  return new google.maps.Marker({
        //    position: location,
        //  });
        //});
        //console.log(markers);
        var geocoder = new google.maps.Geocoder();
        var list = cityslist.map(function(city, i){
          return new geocoder.geocode({'address': city}, function(results, status) {
            if (status === 'OK') {
              console.log(results);
              console.log(results[0].geometry.bounds['Ya']['i']);
              console.log(results[0].geometry.location.lat);
              var abc = new google.maps.Marker({
                position: results[0].geometry.location,
                map: map,
              });
            return abc;
            };
          });
        });
        // Add a marker clusterer to manage the markers.
        var markerCluster = new MarkerClusterer(map, list,
          {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});



        document.getElementById('submit').addEventListener('click', function() {
          geocodeAddress(geocoder, map);
        });
      }
0 Answers
Related