Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mapbox/dobbyscan
A very fast density based clustering library for geographic points
https://github.com/mapbox/dobbyscan
Last synced: 9 days ago
JSON representation
A very fast density based clustering library for geographic points
- Host: GitHub
- URL: https://github.com/mapbox/dobbyscan
- Owner: mapbox
- License: isc
- Created: 2018-02-02T16:37:29.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-07-01T09:47:45.000Z (4 months ago)
- Last Synced: 2024-10-19T09:06:29.719Z (17 days ago)
- Language: JavaScript
- Size: 19.5 KB
- Stars: 86
- Watchers: 103
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## dobbyscan [![Node](https://github.com/mapbox/dobbyscan/actions/workflows/node.yml/badge.svg)](https://github.com/mapbox/dobbyscan/actions/workflows/node.yml) [![Simply Awesome](https://img.shields.io/badge/simply-awesome-brightgreen.svg)](https://github.com/mourner/projects)
A very fast density based clustering JavaScript library for geographic points. Implements a variation of [DBSCAN](https://en.wikipedia.org/wiki/DBSCAN) with great circle distance metric.
### Example
```js
const clusters = dobbyscan(points, radius, p => p.lon, p => p.lat);
```### API
#### dobbyscan(points, radius[, getLng, getLat])
Returns an array of clusters, where each cluster is an array of points (from the input array).
- `points`: an array of input points of an arbitrary format.
- `radius`: density clustering radius in kilometers.
- `getLng`: (optional) a function that returns longitude given an input point, `(p) => p[0]` by default.
- `getLat`: (optional) a function that returns latitude given an input point, `(p) => p[1]` by default.### Performance
This library is incredibly fast — run `bench.js` to see it cluster 135k points in one second.
### Install
```
npm install dobbyscan
```