Skip to content

KBE3D / KBCore / turf / interpolate

函数: interpolate()

interpolate<T>(points: FeatureCollection<Point>, cellSize: number, options?: { gridType?: T; property?: string; units?: Units; weight?: number; bbox?: BBox; }): FeatureCollection<T extends "point" ? Point : Polygon>

Function

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

.

类型参数

T

T extends Grid = "square"

参数

points

FeatureCollection<Point>

with known value

cellSize

number

the distance across each grid point

options?

Optional parameters

gridType?

T

defines the output format based on a Grid Type (options: 'square' | 'point' | 'hex' | 'triangle')

property?

string

the property name in points from which z-values will be pulled, zValue fallbacks to 3rd coordinate if no property exists.

units?

Units

used in calculating cellSize. Supports all valid Turf Units

.

weight?

number

exponent regulating the distance-decay weighting

bbox?

BBox

Bounding Box Array [west, south, east, north] associated with the FeatureCollection.

返回

FeatureCollection<T extends "point" ? Point : Polygon>

grid of points or polygons with interpolated 'property'

示例

ts
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);

//addToMap
var addToMap = [grid];

KBE3D @3.0.0 Copyright © 2024-present KBE3D