https://github.com/smira/go-point-clustering
(Lat, lon) points fast clustering using DBScan algorithm
https://github.com/smira/go-point-clustering
clustering dbscan geolocation point-clustering
Last synced: 4 months ago
JSON representation
(Lat, lon) points fast clustering using DBScan algorithm
- Host: GitHub
- URL: https://github.com/smira/go-point-clustering
- Owner: smira
- License: other
- Created: 2015-04-17T14:41:28.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2019-06-27T13:40:53.000Z (about 7 years ago)
- Last Synced: 2025-08-13T18:36:19.713Z (11 months ago)
- Topics: clustering, dbscan, geolocation, point-clustering
- Language: Go
- Size: 33.2 KB
- Stars: 52
- Watchers: 2
- Forks: 16
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Point Clustering
[](https://travis-ci.org/smira/go-point-clustering)
[](https://codecov.io/gh/smira/go-point-clustering)
[](https://godoc.org/github.com/smira/go-point-clustering)
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fsmira%2Fgo-point-clustering?ref=badge_shield)
(Lat, lon) points fast clustering using [DBScan](https://en.wikipedia.org/wiki/DBSCAN) algorithm in Go.
Given set of geo points, this library can find clusters according to specified params. There are several optimizations
applied:
* distance calculation is using "fast" implementations of sine/cosine, with `sqrt` being removed
* to find points within `eps` distance [k-d tree](https://en.wikipedia.org/wiki/K-d_tree) is being used
* edge case handling of identical points being present in the set
## Usage
Build list of points:
```go
points := cluster.PointList{{30.258387, 59.951557}, {30.434124, 60.029499}, ...}
```
Pick settings for DBScan algorithm:
* `eps` is clustering radius (in kilometers)
* `minPoints` is number of points in `eps`-radius of base point to consider it being part of the cluster
`eps` and `minPoints` together define minimum density of the cluster.
Run DBScan:
```go
clusters, noise := cluster.DBScan(points, 0.8, 10) // eps is 800m, 10 points minimum in eps-neighborhood
```
`DBScan` function returns list of clusters (each `Cluster` being reference to the list of source `points`) and list
of point indexes which don't fit into any cluster (`noise`).
## License
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fsmira%2Fgo-point-clustering?ref=badge_large)