Google MarkerClusterer Handling Multiple Markers On Same Geo Location

When you are dealing with addresses on Google Maps there are times when you have multiple addresses for a same location. For example if you live in a building with 200+ apartments, building address remains the same but you also add apartment number to your address to precisely locate you.

Here are couple of address examples

1/991 Buleen Road
2/991 Buleen Road

From the example above its clear that 991 buleen road is building address, 1 and 2 are apartment numbers.

I would just use InfoWindow to go with MarkerCluster to show details of multiple points.

Lets check out the code below

 

And that’s pretty much it.

Here is a working example of above code

Two things to remember while doing above code

  1. You have to instantiate MarkerClustere
  2. While creating Markers, you can add any custom property to your marker, or hell of an amount of data, so when you create your info window, you have that data available.

Also you can have a look at another way of handling it

https://github.com/jawj/OverlappingMarkerSpiderfier

I hope this helps or at least gives you a pointer what you should be doing for multiple markers for same location.

Cheers,

 

Comments

  1. Hi thanks, but another change multiple location map with find particular address location of marker visibilty, another address marker dont show please provide code

  2. Hi and thank You so much for sharing! It was very helpfull!
    I just wounder how do I do when I want to show a picture in my infowindow. I have to flats on the same address and I want link to their description from my infowindow but I want want to show the picture of the first ine only. Is it possible?

  3. Hi! Great and exactly what I was looking for! Thx:) I wounder how to do if I have pictures in My info windows? I do not want to show 2 pictures or more if I have 2 or more places on the same address. Any idea?
    Best for you and thank you for sharing!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.