Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

834
Visualizações
How can I resolve? InvalidValueError: setMap: not an instance of Map; and not an instance of StreetViewPanorama

I am using the clusters markers example from the Google Maps API. https://developers.google.com/maps/documentation/javascript/marker-clustering#maps_marker_clustering-javascript

Markerclusterer CDN is already called.

But I get the error of InvalidValueError: setMap: not an instance of Map; and not an instance of StreetViewPanorama

Below is the code which I used. What am I doing wrong?

var map;

function initialize() {
  var mapProp = {
    center: new google.maps.LatLng(38, -78),
    zoom: 6,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  map = new google.maps.Map(document.getElementById('map'), mapProp);
};

jQuery(document).ready(function() {
  var url = 'https://opendata.howardcountymd.gov/resource/96q9-qbh7.json';
  initialize();
  jQuery.getJSON(url, function(data) {
    jQuery.each(data, function(i, field) {
     
      createMarker(data);
    
      function createMarker(data) {
       const labels = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

        var markers = new google.maps.Marker({
          position: new google.maps.LatLng(data[i].location.latitude, data[i].location.longitude),
          map: map,
          label: labels[i % labels.length],
          title: field.crossroad
        });
      };
      
       // Add a marker clusterer to manage the markers.
        new MarkerClusterer({ markers, map });
    });
  });

});
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda