Beau Bouchard
Beau Bouchard

Reputation: 827

How can I cluster markers without overlap with google maps?

I am currently clustering hundreds of markers on my google maps. Many of the markers are based on geo-coded addresses, which at times only resolve to the city level. Normally i will end up with lets say a few hundred addresses all with the same lat lon for example in the middle of New York City.

I know about the Marker Clustering in google maps, however when all the markers have the same lat long, you loose the ability to click on each marker, and bring up a popup.

How can I manage these markers in such a way when you zoom in you can still tell how many markers there are, and still click on them?

Upvotes: 2

Views: 5644

Answers (2)

geocodezip
geocodezip

Reputation: 161334

Look at the OverlappingMarkerSpiderfier

See this post on integrating it with MarkerClusterer

Upvotes: 2

PA.
PA.

Reputation: 29339

I had a similar (albeit not exactly the same) problem.

I needed to draw sample points in a plot chart. But I found collisions (exact overlap for some points coming from coarser lectures) and aliasing artifacts (partial overlaps with repeating some fixed amount of displacement due also to coarser lectures).

I decided to introduce some random displacements to all of the points. The "noise" had a normal distribution with a variance two times smaller than the variance of the measured error of the sample, so it did not change add significant variance to the perceived sample. The result was a much clearer chart, more informative, and nicer.

Applying this experience in your case, I would detect exact overlaps in Lat Long and for those I would add some random Lat and Long, effectively moving the point a bit away of its original position and thus avoiding the exact overlap.

Upvotes: 1

Related Questions