1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
const markerCluster = new MarkerClusterer({ map, markers, algorithm, renderer: { render({ count, position }, stats) { const color = "#000"; const svg = window.btoa(` <svg fill="${color}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240"> <circle cx="120" cy="120" opacity=".6" r="70" /> <circle cx="120" cy="120" opacity=".3" r="90" /> <circle cx="120" cy="120" opacity=".2" r="110" /> </svg> `); return new google.maps.Marker({ position, icon: { url: `data:image/svg+xml;base64,${svg}`, scaledSize: new google.maps.Size(50, 50), }, label: { text: String(count), color: "rgba(255,255,255,1)", fontSize: "12px", }, title: `Cluster of ${count} markers`, zIndex: Number(google.maps.Marker.MAX_ZINDEX) + count, }); } }});
|