/js-MakerCluster

markers cluster algorithm for js(点聚合算法,内含方格聚合算法和半径聚合算法)

Primary LanguageJavaScript

License

#update

  • version: 0.6
  • desc:
  • v0.6 use new markers cluster algorithm
  • v0.5 optimize second cluster markers distance and center point algorithm
  • v0.4 optimize cluster markers
  • v0.3 enlarge cluster area, optimize user move map experience
  • v0.2 recluster clustered markers
  • v0.1 Complete basic functions

#How to use

//grid algorithm
var rs = mc.init(lngmaxX,lngminX,latmaxY,latminY,PointList);
//distance algorithm
var rs = mc.initv2(lngmaxX,lngminX,latmaxY,latminY,PointList);

PointList json format:

{
	"data": [{
		"longitude": "120.18803",
		"latitude": "30.35983"
	}, {
		"longitude": "120.20222",
		"latitude": "30.35844"
	}]
}

#example for tencent map:

//grid algorithm
var rs = mc.init(map.getBounds().lng.maxX,map.getBounds().lng.minX,map.getBounds().lat.maxY,map.getBounds().lat.minY,PointList);
//distance algorithm
var rs = mc.initv2(map.getBounds().lng.maxX,map.getBounds().lng.minX,map.getBounds().lat.maxY,map.getBounds().lat.minY,PointList);