distanceWeight
描述
¥Description
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
fc | FeatureCollection<any> | 要素集合。 |
options? | 对象 | 选项对象。 |
options.threshold? | number | 如果邻近要素与目标要素之间的距离大于阈值,则该邻近要素的权重为 0。(默认 10000) |
options.p? | number | 明可夫斯基 p 范数距离参数。1:曼哈顿距离。2:欧氏距离。1=<p<=无穷大。(默认 2) |
options.binary? | boolean | 如果为 true,则 weight=1,如果 d <= 阈值,否则 weight=0。如果为 false,则 weight=Math.pow(d, alpha)。(默认 false) |
options.alpha? | number | 距离衰减参数。较大的值表示权重会随着距离的增加而快速衰减。(默认 -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(...);