Skip to content

KBE3D / KBCore / turf / isolines

函数: isolines()

isolines(pointGrid: FeatureCollection<Point>, breaks: number[], options?: { zProperty?: string; commonProperties?: GeoJsonProperties; breaksProperties?: GeoJsonProperties[]; }): FeatureCollection<MultiLineString, GeoJsonProperties>

Function

Takes a grid FeatureCollection of Point features with z-values and an array of value breaks and generates isolines

.

参数

pointGrid

FeatureCollection<Point>

input points - must be square or rectangular and already gridded. That is, to have consistent x and y dimensions and be at least 2x2 in size.

breaks

number[]

values of zProperty where to draw isolines

options?

Optional parameters

zProperty?

string

the property name in points from which z-values will be pulled

commonProperties?

GeoJsonProperties

GeoJSON properties passed to ALL isolines

breaksProperties?

GeoJsonProperties[]

GeoJSON properties passed, in order, to the correspondent isoline; the breaks array will define the order in which the isolines are created

返回

FeatureCollection<MultiLineString, GeoJsonProperties>

a FeatureCollection of MultiLineString features representing isolines

示例

ts
// create a grid of points with random z-values in their properties
var extent = [0, 30, 20, 50];
var cellWidth = 100;
var pointGrid = turf.pointGrid(extent, cellWidth, {units: 'miles'});

for (var i = 0; i < pointGrid.features.length; i++) {
    pointGrid.features[i].properties.temperature = Math.random() * 10;
}
var breaks = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

var lines = turf.isolines(pointGrid, breaks, {zProperty: 'temperature'});

//addToMap
var addToMap = [lines];

KBE3D @3.0.0 Copyright © 2024-present KBE3D