Skip to main content
Version: 7.2.0

clustersDbscan

描述

¥Description

获取一组 points,并根据 DBSCAN 算法 数据聚类算法将其划分为不同的聚类。

¥Takes a set of points and partition them into clusters according to DBSCAN's data clustering algorithm.

参数

¥Parameters

名称类型描述
pointsFeatureCollection<>待聚类
maxDistancenumber生成聚类的聚类中任意点之间的最大距离(默认为公里,请参阅选项)
options?对象可选参数(默认 {})
options.units?string其中 maxDistance 以度、弧度、英里或公里表示(默认 "kilometers")
options.mutate?boolean允许 GeoJSON 输入发生修改(默认为 false)
options.minPoints?number生成单个聚类所需的最小点数,不符合此要求的点将被归类为 'edge' 或 'noise'。(默认 3)

返回

¥Returns

FeatureCollection<, DbscanProps> 聚类点,每个要素具有另外两个关联属性:

¥FeatureCollection<Point, DbscanProps> Clustered Points with an additional two properties associated to each Feature:

  • ---左括号---数字---右括号--- 簇 - 关联的 clusterId

    ¥{number} cluster - the associated clusterId

  • ---左括号---字符串---右括号--- dbscan - 被分类为的点的类型 ('core' | 'edge' | 'noise')

    ¥{string} dbscan - type of point it has been classified as ('core' | 'edge' | 'noise')

示例

¥Examples

// 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);

安装

¥Installation

$ npm install @turf/clusters-dbscan

import { clustersDbscan } from "@turf/clusters-dbscan";
const result = clustersDbscan(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.clustersDbscan(...);