interpolate
描述
¥Description
Takes a set of points and estimates their 'property' values on a grid using the 反距离加权 (IDW) 方法.
¥Takes a set of points and estimates their 'property' values on a grid using the Inverse Distance Weighting (IDW) method.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
points | FeatureCollection<点> | 已知值 |
cellSize | number | the distance across each grid point |
options? | 对象 | 可选参数(默认 ) |
options.gridType? | string | defines the output format based on a Grid Type (options: 'square' | 'point' | 'hex' | 'triangle') (default 'square') |
options.property? | string | the property name in points from which z-values will be pulled, zValue fallbacks to 3rd coordinate if no property exists.(默认 'elevation') |
options.units? | string | used in calculating cellSize, can be degrees, radians, miles, or kilometers (default 'kilometers') |
options.weight? | number | exponent regulating the distance-decay weighting (default 1) |
options.bbox? | BBox | Bounding Box Array [west, south, east, north] associated with the FeatureCollection.(默认 bbox(points)) |
返回
¥Returns
FeatureCollection<点 | 多边形> grid of points or polygons with interpolated 'property'
¥FeatureCollection<Point | Polygon> grid of points or polygons with interpolated 'property'
示例
¥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(...);