Google map Marker cluster 谷歌地图图标聚合


Have you wonder how do some map app provide functions to cluster icons/markers?

Here is one solution:

http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.1.2/docs/examples.html

Inside the code:

MarkerCluster obj

    hide all markers first, calculate the markers distance, cluster them together in pixel distance and then show the clustericon

     add markers
     resetviewport
     redraw
     createClusters_
     addToClosestCluster_
     distanceBetweenPoints_
     if two markers are closer than 40000, cluster them together
     new Cluster

Cluster obj
ClusterIcon obj, extended from overlayview

原文地址:https://www.cnblogs.com/mqxnongmin/p/10907379.html