Skip to content

Commit 115eaba

Browse files
committed
Correctly use the specified units when calculating clusters
Previously we would use a hardcoded kilometers unit against maxDistance. Instead we specify options.units and use the default kilometers distance arg when it was not specified. This carries forward the original intent of the PR and fixes the bug where even after the revert of the kdbush change we were not honoring the units option when creating clusters.
1 parent f1ced65 commit 115eaba

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/turf-clusters-dbscan/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function clustersDbscan(
142142
const neighborIndex = neighbor.index;
143143
const neighborPoint = points.features[neighborIndex];
144144
const distanceInKm = distance(point, neighborPoint, {
145-
units: "kilometers",
145+
units: options.units,
146146
});
147147
return distanceInKm <= maxDistance;
148148
}

0 commit comments

Comments
 (0)