distanceWeight
描述
¥Description
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
fc | FeatureCollection<任意> | 要素集合。 |
options? | 对象 | 选项对象。 |
options.threshold? | number | If the distance between neighbor and target features is greater than threshold, the weight of that neighbor is 0.(默认 10000) |
options.p? | number | 明可夫斯基 p 范数距离参数。1:曼哈顿距离。2:欧氏距离。1=<p<=无穷大。(默认 2) |
options.binary? | boolean | If true, weight=1 if d <= threshold otherwise weight=0.如果为 false,则 weight=Math.pow(d, alpha)。(默认 false) |
options.alpha? | number | 距离衰减参数。A big value means the weight decay quickly as distance increases.(默认 -1) |
options.standardization? | boolean | 行标准化。(默认 false) |
返回
¥Returns
¥Array<Array<number>> distance weight matrix.
示例
¥Examples
var bbox = [-65, 40, -63, 42];
var dataset = turf.randomPoint(100, { bbox: bbox });
var result = turf.distanceWeight(dataset);
安装
¥Installation
$ npm install @turf/distance-weight
import { distanceWeight } from "@turf/distance-weight";
const result = distanceWeight(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.distanceWeight(...);