Appearance
KBE3D / KBCore / turf / interpolate
函数: interpolate()
interpolate<
T>(points:FeatureCollection<Point>,cellSize:number,options?: {gridType?:T;property?:string;units?:Units;weight?:number;bbox?:BBox; }):FeatureCollection<Textends"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
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?
used in calculating cellSize. Supports all valid Turf Units.
weight?
number
exponent regulating the distance-decay weighting
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];