Skip to main content
Version: 7.2.0

distanceWeight

描述

¥Description

参数

¥Parameters

名称类型描述
fcFeatureCollection<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

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