Skip to main content
Version: Next

distanceWeight

描述

¥Description

参数

¥Parameters

名称类型描述
fcFeatureCollection<任意>要素集合。
options?对象选项对象。
options.threshold?numberIf 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?booleanIf 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

数组<数组<number>> 距离权重矩阵。

¥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(...);