question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MarkerCluster custom image is not replaced

See original GitHub issue

I am trying to provide custom images for the cluster. I checked both react-google-maps doc and google map doc. According to both document, it will change images if you provide image path. on that /static/images/cluster/m contains m1.png … m5.png images. I also checked network image tab and it does not even try to get image from custom path. It just getting image from v3 lib. Any opinion ?

<MarkerClusterer
       averageCenter
       maxZoom={15}
       defaultMaxZoom={20}
       onClick={(e) => {console.log(e)}}
       gridSize={60}
       imagePath='/static/images/cluster/m'
>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

14reactions
intelcodercommented, Oct 2, 2017

@tomchentw I tried this and it changes image


styles={[
              {
                url: "/static/images/cluster/m1.png",
                height: 53,
                width: 53
              },
              {
                url: "/static/images/cluster/m2.png",
                height: 53,
                width: 53
              },
              {
                url: "/static/images/cluster/m3.png",
                height: 53,
                width: 53
              },
              {
                url: "/static/images/cluster/m4.png",
                height: 53,
                width: 53
              },
              {
                url: "/static/images/cluster/m5.png",
                height: 53,
                width: 53
              }
            ]}
5reactions
gabmacommented, Jun 20, 2018

@Jiia

Here’s how me managed it. Check the Google doc as well, since some configurations are not linked to react-google-maps implementation.

<MarkerClusterer		
      averageCenter		
      enableRetinaIcons		
      gridSize={40}		
      minimumClusterSize={4}		
      maxZoom={15}		
      zoomOnClick={true}		
      onClick={props.onMarkerClustererClick}		
      styles={[		
         {		
           url: "/img/map-cluster/m1.png",		
           height: 26,		
           width: 26,		
           fontFamily:"Lato",		
           textColor:"#FFF",		
        },		
        {		
          url: "/img/map-cluster/m2.png",		
          height: 29,		
          width: 29,		
          fontFamily:"Lato",		
          textColor:"#FFF",		
        },		
        {		
          url: "/img/map-cluster/m3.png",		
          height: 34,		
          width: 34,		
          fontFamily:"Lato",		
          textColor:"#FFF",		
        },		
        {		
          url: "/img/map-cluster/m4.png",		
          height: 40,		
          width: 40,		
          fontFamily:"Lato",		
          textColor:"#FFF",		
        },		
        {		
          url: "/img/map-cluster/m5.png",		
          height: 46,		
          width: 46,		
          fontFamily:"Lato",		
          textColor:"#FFF",		
        } 		
      ]}		
>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Google map cluster custom image - Stack Overflow
I was able to change cluster image by providing styles option which is like below. I am not sure why imagePath does not...
Read more >
Incorporating custom/image markers into Leaflet MarkerCluster?
It works fine, however, when you drill down to an individual marker (not cluster) I can't figure out how to replace the standard...
Read more >
Label text can't be positioned on custom cluster marker - Drupal
I can change the color, size of the label text but not its position even if ... I can't positioned the label text...
Read more >
How to Change the Marker Cluster Images?
It is possible to change the default Marker Cluster images to something of your own preference. Changing Marker Cluster Images/Icons All ...
Read more >
Change the Marker Cluster Images - WP Store Locator
Set a Custom Image Path. If it doesn't already exist, then first create a wpsl-markers folder in your active theme folder. Move your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found