interpolate
描述
🌐 Description
获取一组点,并使用反距离加权(IDW)方法在网格上估计它们的“属性”值。
🌐 Takes a set of points and estimates their 'property' values on a grid using the Inverse Distance Weighting (IDW) method.
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| points | FeatureCollection<Point> | 已知值 |
| cellSize | number | 每个网格点的距离 |
| options? | Object | 可选参数 (默认 {}) |
| options.gridType? | string | 基于网格类型定义输出格式(选项:'square' |
| options.property? | string | points 中将提取 z 值的属性名称,如果该属性不存在,zValue 将回退到第三坐标。(默认值 'elevation') |
| options.units? | Units | 用于计算 cellSize。支持所有有效的 Turf 单位。(默认 '公里') |
| options.weight? | number | 调节距离衰减权重的指数 (默认 1) |
| options.bbox? | BBox | 与 FeatureCollection 关联的边界框数组 [西, 南, 东, 北]。(默认 bbox(points)) |
返回
🌐 Returns
FeatureCollection<Point | Polygon> 具有插值“属性”的点或多边形网格
示例
🌐 Examples
var points = turf.randomPoint(30, { bbox: [50, 30, 70, 50] });
// add a random property to each point
turf.featureEach(points, function (point) {
point.properties.solRad = Math.random() * 50;
});
var options = { gridType: "points", property: "solRad", units: "miles" };
var grid = turf.interpolate(points, 100, options);
安装
🌐 Installation
$ npm install @turf/interpolate
import { interpolate } from "@turf/interpolate";
const result = interpolate(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.interpolate(...);