Styling MarkerClusterer Icons?

前端 未结 2 705
灰色年华
灰色年华 2021-01-31 07:47

I am using the MarkerCluster.js to create clustering in my google maps api. The clusters work how I want them however I want to style differently than yellow, blue and red circl

相关标签:
2条回答
  • 2021-01-31 08:06

    It's never too late to post a rather helpful answer, so additionally you can look through the whole MarkerClusterer Documentation for IconStyle

    UPDATE

    There's also google maps v3 utility on github as stated by ehcanadian

    0 讨论(0)
  • 2021-01-31 08:23

    What you need to do is use the url to specify which images to use instead of the blue/yellow/red images currently being used. And probably a good idea to include the height and width options too.

    var clusterStyles = [
      {
        textColor: 'white',
        url: 'path/to/smallclusterimage.png',
        height: 50,
        width: 50
      },
     {
        textColor: 'white',
        url: 'path/to/mediumclusterimage.png',
        height: 50,
        width: 50
      },
     {
        textColor: 'white',
        url: 'path/to/largeclusterimage.png',
        height: 50,
        width: 50
      }
    ];
    
    0 讨论(0)
提交回复
热议问题