Antwort

57

Sie müssen styles-Parameter verwenden, wenn MarkerClusterer Objekt initialisiert wird - der Code unten zeigt Standardstile so, wenn Sie eines der Symbole recolour wollen einfach nur die entsprechende URL zu Ihrem Bild ändern ...

//set style options for marker clusters (these are the default styles) 
mcOptions = {styles: [{ 
height: 53, 
url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m1.png", 
width: 53 
}, 
{ 
height: 56, 
url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m2.png", 
width: 56 
}, 
{ 
height: 66, 
url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m3.png", 
width: 66 
}, 
{ 
height: 78, 
url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m4.png", 
width: 78 
}, 
{ 
height: 90, 
url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m5.png", 
width: 90 
}]} 

//init clusterer with your options 
var mc = new MarkerClusterer(map, markers, mcOptions); 
+0

Sieht aus wie es Kommas in der Eigenschaftenliste für jeden einzelnen Marker fehlt ... von FireFox 'Fehler: fehlt} nach der Eigenschaftsliste'. –

0

These Symbole sind nicht mehr auf Googles-Servern.

+0

sie ändern Repo zu git Hub hier ist der icone https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images – jayesh

+0

@Kaippally Ich habe eine Lösung für diese in den folgenden SO Post [Was ist der alternative Quellpfad für die Bibliothek google markerclusterer.js?] (http://stackoverflow.com/a/37183674/1301937) –

7

Google hat sein Repo geändert. Neueste Cluster Repo ist: Bilder: https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images

Sie können auch in Erwägung ziehen, Quelle herunterladen und Link von Ihrem lokalen Pfad geben. Auf diese Weise haben Sie mehr Kontrolle über die Ressourcen, die Ihre Anwendung benötigt.

local_path "/pucblic/" 
mcOptions = {styles: [{ 
height: 53, 
url: local_path+"m1.png", 
width: 53 
}, 
{ 
height: 56, 
url: local_path+"m2.png", 
width: 56 
}, 
{ 
height: 66, 
url: local_path+"m3.png", 
width: 66 
}, 
{ 
height: 78, 
url: local_path+"m4.png", 
width: 78 
}, 
{ 
height: 90, 
url: local_path+"m5.png", 
width: 90 
}]} 
2

Eine Verknüpfung ist das Überschreiben der Bildpfad wie folgt aus:

MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ = 
    "https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/markerclustererplus/images/m"; 
+1

Der obige Pfad ist nicht korrekt https://raw.githubusercontent.com/googlemaps/v3- utility-library/master/markerclustererplus/images/m1.png –

+0

Geniale Lösung, verwenden Sie einfach einen lokalen Pfad anstelle der rohen github Inhalt URL. – phaberest

0

Hier wird original Fotos

markerClusterOptions = {styles: [{ 
    height: 53, 
    url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m1.png", 
    width: 53 
    }, 
    { 
    height: 56, 
    url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m2.png", 
    width: 56 
    }, 
    { 
    height: 66, 
    url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m3.png", 
    width: 66 
    }, 
    { 
    height: 78, 
    url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m4.png", 
    width: 78 
    }, 
    { 
    height: 90, 
    url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m5.png, 
    width: 90 
    }]} 
    markerCluster = new MarkerClusterer(map, markers,markerClusterOptions);