我有一個帶有標記的谷歌地圖,帶有聚類。
我可以使用如下代碼輕松更改標記圖示:
marker = new google.maps.Marker({
position: {
lat: location_data.lat,
lng: location_data.lng
},
map: map,
icon: img_url 'map-marker.svg',
});
但是,我堅持更改群集圖示。這段代碼可以很好地進行實際的聚類:
const marker_clusterer = new markerClusterer.MarkerClusterer({
map: map,
markers: markers
});
我發現那里的代碼表明了這一點:
const marker_clusterer = new markerClusterer.MarkerClusterer({
map: map,
markers: markers,
renderer: {
imagePath: img_url 'map-cluster'
}
});
map-cluster一堆檔案的前綴在哪里,例如map-cluster1.svg. 這給了我錯誤:'Uncaught TypeError: e.renderer.render is not a function'。
我也試過這個:
const marker_clusterer = new markerClusterer.MarkerClusterer({
map: map,
markers: markers,
renderer: {
styles: [{
url: img_url 'map-cluster1.svg',
}]
}
});
為此,我再次遇到同樣的錯誤。
There are other code examples which don't seem to bear any relation to the code I'm already working with, heaps of custom objects (e.g. 
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/427062.html
標籤:谷歌地图
下一篇:地圖未顯示在Laravel專案中
