Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps Api v3, custom Cluster icon

how can i change cluster icon? i wolud like to have same icon, with some other color than blue.

like image 973
user198003 Avatar asked Dec 11 '10 09:12

user198003


People also ask

Can you customize Google Maps API?

The Google Maps APIs now support you in creating beautiful styled maps for your Android and iOS apps as well as your website using the same JSON style object.


1 Answers

You need to use styles parameter when initializing MarkerClusterer object - the code below shows default styles so if you want to recolour one of the icons just change the relevant url to your image...

//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: "https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images/m2.png", width: 56 }, { height: 66, url: "https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images/m3.png", width: 66 }, { height: 78, url: "https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images/m4.png", width: 78 }, { height: 90, url: "https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images/m5.png", width: 90 }]}  //init clusterer with your options var mc = new MarkerClusterer(map, markers, mcOptions); 
like image 150
Michal Avatar answered Sep 19 '22 15:09

Michal