Appearance
KBE3D / KBCore / turf / clustersDbscan
函数: clustersDbscan()
clustersDbscan(
points:FeatureCollection<Point>,maxDistance:number,options?: {units?:Units;minPoints?:number;mutate?:boolean; }):FeatureCollection<Point, {[name:string]:any; } & {dbscan?:Dbscan;cluster?:number; }>
Function
Takes a set of points and partition them into clusters according to https://en.wikipedia.org/wiki/DBSCAN|DBSCAN's data clustering algorithm.
参数
points
to be clustered
maxDistance
number
Maximum Distance between any point of the cluster to generate the clusters (kilometers by default, see options)
options?
Optional parameters
units?
in which maxDistance is expressed, Supports all valid Turf Units
minPoints?
number
Minimum number of points to generate a single cluster, points which do not meet this requirement will be classified as an 'edge' or 'noise'.
mutate?
boolean
Allows GeoJSON input to be mutated
返回
FeatureCollection<Point, {[name: string]: any; } & { dbscan?: Dbscan; cluster?: number; }>
Clustered Points with an additional two properties associated to each Feature:
- {number} cluster - the associated clusterId
- {string} dbscan - type of point it has been classified as ('core'|'edge'|'noise')
示例
ts
// create random points with random z-values in their properties
var points = turf.randomPoint(100, {bbox: [0, 30, 20, 50]});
var maxDistance = 100;
var clustered = turf.clustersDbscan(points, maxDistance);
//addToMap
var addToMap = [clustered];