Clustering with option minPoints 1
See original GitHub issueWith option minPoints: 1, my assumption would be that a cluster could exist with 1 point in the cluster area, but since minPoints is 1, it would have zero neighbors.
Including another if (!clusterProperties) clusterProperties = this._map(p, true); after the for loop solves this by setting the clusterProperties when no neighbors are found.
Fork with change: https://github.com/michaelfarrelly/supercluster/commit/3dbbc52fc0c7bb8a20cc52ac338f74b3c4ddfca0
If this against the purpose of this property, then I can revoke this request. My projects goal was to have clustering only (no points) when zoomed out.
https://github.com/mapbox/supercluster/blob/main/index.js#L266-L282
for (const neighborId of neighborIds) {
const b = tree.points[neighborId];
if (b.zoom <= zoom) continue;
b.zoom = zoom; // save the zoom (so it doesn't get processed twice)
const numPoints2 = b.numPoints || 1;
wx += b.x * numPoints2; // accumulate coordinates for calculating weighted center
wy += b.y * numPoints2;
b.parentId = id;
if (reduce) {
if (!clusterProperties) clusterProperties = this._map(p, true);
reduce(clusterProperties, this._map(b));
}
}
=>
for (const neighborId of neighborIds) {
const b = tree.points[neighborId];
if (b.zoom <= zoom) continue;
b.zoom = zoom; // save the zoom (so it doesn't get processed twice)
const numPoints2 = b.numPoints || 1;
wx += b.x * numPoints2; // accumulate coordinates for calculating weighted center
wy += b.y * numPoints2;
b.parentId = id;
if (reduce) {
if (!clusterProperties) clusterProperties = this._map(p, true);
reduce(clusterProperties, this._map(b));
}
}
if (!clusterProperties) clusterProperties = this._map(p, true);
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:6
Top Results From Across the Web
Density-Based Clustering Methods - GeoDa
Border points and minimum cluster size. The DBSCAN algorithm depends critically on the choice of two parameters. One is the Distance Threshold, ...
Read more >DBSCAN: Density-Based Clustering Essentials - Datanovia
DBSCAN algorithm requires users to specify the optimal eps values and the parameter MinPts. In the R code above, we used eps =...
Read more >DBSCAN Clustering — Explained - Towards Data Science
Clustering is a way to group a set of data points in a way that similar data points are grouped together. Therefore, clustering...
Read more >Parameter Selection for HDBSCAN - Read the Docs
We will consider those major parameters, and consider how one may go ... The primary parameter to effect the resulting clustering is min_cluster_size...
Read more >How to determine epsilon and MinPts parameters of DBSCAN ...
DBSCAN (Density-Based Spatial Clustering of Applications with Noise) ... The low value of MinPts=1 does not make sense, as then every point ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Encountered same situation BUT : My opinion is that the
minPointspurpose is different from theclusterOnlypurpose where thegetClustersmethod should only return clusters. The goal of theminPointsoptions is to define the minimum of points to be able to create a Cluster. Whereas aclusterOnlyoptions would force the algorithm to return clusters.IMO Both parameters could be used, for ex to have clusters with a
minPoints = 3andclustersOnly = truewhere it would form normal clusters of 3 points minimum, and the other points would be clusterized in clusters of 1 point.Same for me.
clusterOnlycan be a good property to have a proper display with clusters only.