将自定义图像添加到标记群集而不覆盖标记

我有以下jQuery代码添加地图标记集群:

markerCluster = new MarkerClusterer(map); 

我正在使用markerCluster.addMarker(Marker); 将单个标记添加到群集(页面底部的完整代码块)。

我遇到的问题是我的群集默认没有附加图像。

我可以做以下事情:

 var options = 'an image path'; markerCluster = new MarkerClusterer(map,markers,options); 

但是由于选项是第三个参数,我实际上会覆盖第二个参数。 有没有办法将图像设置为MarkerCluster而不覆盖标记?

 (function () { var address = response[key]["address"]; $.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address='+response[key]["post_code"]+'&sensor=false', null, function (data) { var p = data.results[0].geometry.location var latlng = new google.maps.LatLng(p.lat, p.lng); var Marker = new google.maps.Marker({ position: latlng, map: map, content: address }); markerCluster.addMarker(Marker); google.maps.event.addListener(Marker, 'click', function () { infowindow.setContent(this.content); infowindow.open(map, this); }); }); })(); 

默认情况下, MarkerClustererMarkerClusterer文件夹中查找标记(相对于markerclusterer.js的位置)。

最简单的方法是从github获取图像文件夹,因此文件的结构如下:

 -images -m1.png -m2.png -..etc other files from the directory -SOME_FOLDER //can be lib, libraries, what have you -markerclusterer.js 

或者你可以使用options对象的imagePath属性,所以你会有这样的东西:

 var options = { imagePath: "PATH_TO_IMAGES_FOLDER/m" }; markerCluster = new MarkerClusterer(map, markers, options);