Skip to content

KBE3D / KBCore / turf / distanceWeight

函数: distanceWeight()

distanceWeight(fc: FeatureCollection<any>, options?: { threshold?: number; p?: number; binary?: boolean; alpha?: number; standardization?: boolean; }): number[][]

Function

参数

fc

FeatureCollection<any>

FeatureCollection.

options?

option object.

threshold?

number

If the distance between neighbor and target features is greater than threshold, the weight of that neighbor is 0.

p?

number

Minkowski p-norm distance parameter. 1: Manhattan distance. 2: Euclidean distance. 1=<p<=infinity.

binary?

boolean

If true, weight=1 if d <= threshold otherwise weight=0. If false, weight=Math.pow(d, alpha).

alpha?

number

distance decay parameter. A big value means the weight decay quickly as distance increases.

standardization?

boolean

row standardization.

返回

number[][]

distance weight matrix.

示例

ts
var bbox = [-65, 40, -63, 42];
var dataset = turf.randomPoint(100, { bbox: bbox });
var result = turf.distanceWeight(dataset);

KBE3D @3.0.0 Copyright © 2024-present KBE3D