distanceWeight
描述
🌐 Description
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| fc | FeatureCollection<any> | 要素集合。 |
| options? | Object | 选项对象。 |
| options.threshold? | number | 如果邻居特性与目标特性之间的距离大于阈值,则该邻居的权重为0。(默认值 10000) |
| options.p? | number | Minkowski p-范数距离参数。1:曼哈顿距离。2:欧几里得距离。1=<p<=infinity。(默认 2) |
| options.binary? | boolean | 如果为真,当 d <= 阈值时权重=1,否则权重=0。如果为假,权重=Math.pow(d, alpha)。(默认 false) |
| options.alpha? | number | 距离衰减参数。较大的数值意味着权重会随着距离增加而迅速衰减。(默认 -1) |
| options.standardization? | boolean | 行标准化。(默认 false) |
返回
🌐 Returns
示例
🌐 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(...);