Skip to main content
Version: 7.3.0

interpolate

描述

🌐 Description

获取一组点,并使用反距离加权(IDW)方法在网格上估计它们的“属性”值。

🌐 Takes a set of points and estimates their 'property' values on a grid using the Inverse Distance Weighting (IDW) method.

参数

🌐 Parameters

名称类型描述
pointsFeatureCollection<Point>已知值
cellSizenumber每个网格点的距离
options?Object可选参数 (默认 {})
options.gridType?string基于网格类型定义输出格式(选项:'square'
options.property?stringpoints 中将提取 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(...);