我使用Google Maps Javascript API创建了html页面.此地图显示geojson文件中的标记.一切都很好.我想添加标记聚类.但由于某种原因,这不起作用.我对Javascript不太满意.请告诉我如何更改我的代码.
var map;
function initMap() {
var styleArray = [
{
featureType: 'all',
stylers: [
{ saturation: -80 }
]
},{
featureType: 'road.arterial',
elementType: 'geometry',
stylers: [
{ hue: '#00ffee' },
{ saturation: 50 }
]
},{
featureType: 'poi.business',
elementType: 'labels',
stylers: [
{ visibility: 'off' }
]
}
];
var mapOptions = {
zoom: 14,
center: new google.maps.LatLng(42.34, -71.05),
styles: styleArray
};
var map = new google.maps.Map(document.getElementById('map'),
mapOptions);
// Load GeoJSON.
map.data.loadGeoJson('/map.geojson');
map.data.setStyle(function(feature) {
return {icon:feature.getProperty('icon')}; …
Run Code Online (Sandbox Code Playgroud)