distanceWeight
Description
Parameters
Name | Type | Description |
---|---|---|
fc | FeatureCollection<any> | FeatureCollection. |
options? | Object | option object. |
options.threshold? | number | If the distance between neighbor and target features is greater than threshold, the weight of that neighbor is 0. (default 10000) |
options.p? | number | Minkowski p-norm distance parameter. 1: Manhattan distance. 2: Euclidean distance. 1=<p<=infinity. (default 2) |
options.binary? | boolean | If true, weight=1 if d <= threshold otherwise weight=0. If false, weight=Math.pow(d, alpha). (default false) |
options.alpha? | number | distance decay parameter. A big value means the weight decay quickly as distance increases. (default -1) |
options.standardization? | boolean | row standardization. (default 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(...);