-
Notifications
You must be signed in to change notification settings - Fork 1
/
doc.go
51 lines (50 loc) · 1.65 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// MIT License
//
// Copyright (c) 2016 MadAppGang
// Package cluster a very fast Golang library for geospatial point clustering.
//
//
// cluster is very fast library for geospatial point clustering server side (or client side)
//
// The cluster use hierarchical greedy clustering approach.
//
// The same approach used by Dave Leaver with his fantastic Leaflet.markercluster plugin.
//
// So this approach is extremely fast, the only drawback is that all clustered points are stored in memory
//
// This library is deeply inspired by MapBox's superclaster JS library and blog post: https://www.mapbox.com/blog/supercluster/
//
// Very easy to use:
// //1.Create new cluster
// c := NewCluster()
//
// //2.Convert slice of your objects to slice of GeoPoint (interface) objects
// geoPoints := make([]GeoPoint, len(points))
// for i := range points {
// geoPoints[i] = points[i]
// }
//
// //3.Build index
// c.ClusterPoints(geoPoints)
//
// //3.Get tour tile with mercator coordinate projections to display directly on the map
// result := c.GetTile(0,0,0)
//
//
//
// Library has only one dependency, it's KD-tree geospatial index https://github.com/MadAppGang/kdbush
//
// All ids of ClusterPoint that you have as result are the index of initial array of Geopoint,
// so yu could get you point by this index
//
// Clusters of points are have autoincrement generated ids, started at ClusterIdxSeed
// ClusterIdxSeed is the next power of length of input array
//
// For example, if input slice of points length is 78, ClusterIdxSeed == 100,
// if input slice of points length is 991, ClusterIdxSeed == 1000
// etc
//
// TODO: Benchmarks
//
// TODO: demo server
package cluster