googlearchive / js-marker-clusterer

A marker clustering library for the Google Maps JavaScript API v3.
https://googlemaps.github.io/js-marker-clusterer/docs/reference.html
Apache License 2.0
1.28k stars 772 forks source link

Cluster icon location incorrect to most markers #76

Closed kshipp closed 8 years ago

kshipp commented 8 years ago

I've found that the calculation(?) of the location of the cluster icon to be incorrect at times. I've attached two screenshots.
Map1 = you can see 28 locations at the Oklahoma and Arkansas border (which is incorrect). Only ONE location is near there. Map 2 = shows the zoom when clicking on Map1 ("28" icon). Notice that the Clusterer placed the cluster icon near the Ft. Smith (far left) marker, instead of where it should, either a)..centrally located among all 28 locations, or b)..at the next-largest-cluster (26). Ideally, the cluster icon position needs to be central to all the underlying markers. It looks like it's just choosing a random marker position to represent its location?

Map1 incorrectly shows all the locations too far west Arkansas, whereas 90% of them are exactly central Arkansas. map1 map2

PeterTheOne commented 8 years ago

Set the averageCenter option to true, it is set to false by default. Maybe it should be set to true by default. Other than that this is intended behavior and this issue can be closed.

kshipp commented 8 years ago

PeterTheOne - awesome! I'll give that a try. Thanks for sharing this info. I agree - should be defaulted to True.

kshipp commented 8 years ago

After adding averageCenter option to true, it works perfectly. Thanks!

map3