Estoy usando el ejemplo de marcadores de grupos de la API de Google Maps. https://developers.google.com/maps/documentation/javascript/marker-clustering#maps_marker_clustering-javascript
Markerclusterer CDN ya está llamado.
Pero me sale el error de InvalidValueError: setMap: not an instance of Map; and not an instance of StreetViewPanorama
A continuación se muestra el código que utilicé. ¿Qué estoy haciendo mal?
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 }); }); }); });