asroboy / google-maps-utility-library-v3

Automatically exported from code.google.com/p/google-maps-utility-library-v3
Apache License 2.0
0 stars 0 forks source link

markercluster doesn't center between two points. #165

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If you have two markers on a map, illustrated textually as:

|-------|
| x     |
|       |
|     x |
|-------|

now if you enable markercluster on the map  then you will see that the map now 
looks like this: 

|-------|
|       |
|       |
|    2x |
|-------|

while i would expect the cluster point to center itself between the two points 
as so:

|-------|
|       |
|  2x   |
|       |
|-------|

Original issue reported on code.google.com by k...@heldig.org on 29 Mar 2012 at 1:02

GoogleCodeExporter commented 8 years ago
There is a property for controlling this behavior. It is called 
"averageCenter". If you set it to "true" I think you'll see the behavior you're 
looking for.

From the documentation for MarkerClustererPlus:

averageCenter -- Whether the position of a cluster marker should be the average 
position of all markers in the cluster. If set to false, the cluster marker is 
positioned at the location of the first marker added to the cluster. The 
default value is false.

Original comment by garylitt...@gmail.com on 19 Apr 2012 at 3:18

GoogleCodeExporter commented 8 years ago
Ok, great! may I ask exactly where you found this nugget?

Original comment by k...@heldig.org on 19 Apr 2012 at 4:09

GoogleCodeExporter commented 8 years ago
The MarkerClustererPlus Reference is here:

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererpl
us/docs/reference.html

"averageCenter" is also supported by MarkerClusterer.

Original comment by garylitt...@gmail.com on 19 Apr 2012 at 4:16

GoogleCodeExporter commented 8 years ago
Hm, weird that i never saw that. Anyways, ill test this out. Thank you for 
pointing this out.

Original comment by k...@heldig.org on 19 Apr 2012 at 4:21

GoogleCodeExporter commented 8 years ago
The reason for not making centering of the cluster the default is to improve 
performance although you may not notice with only a few markers being managed. 
Calculating the average is simply more time consuming than using the position 
of the first marker.

Original comment by garylitt...@gmail.com on 19 Apr 2012 at 4:29

GoogleCodeExporter commented 8 years ago

Original comment by garylitt...@gmail.com on 21 Apr 2012 at 3:00