描述
接收具有 z 值的网格 FeatureCollection 的 Point 要素,以及值断点数组,生成 isolines。
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| pointGrid | FeatureCollection<Point> | 输入点 - 必须是正方形或矩形并且已网格化。即具有一致的 x 和 y 维度且至少 2x2 大小。 |
| breaks | Array<number> | 绘制等值线的 zProperty 值 |
| options? | Object | 可选参数 (默认 {}) |
| options.zProperty? | string | points 中从中获取 z 值的属性名称 (默认 'elevation') |
| options.commonProperties? | Object | 传递给所有等值线的 GeoJSON 属性 (默认 {}) |
| options.breaksProperties? | Array<Object> | 按顺序传递给对应等值线的 GeoJSON 属性;断点数组将定义创建等值线的顺序 (default []) |
返回值
FeatureCollection<MultiLineString> 表示等值线的 MultiLineString 要素的 FeatureCollection
示例
javascript
// 创建具有随机 z 值的点网格
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" });安装
javascript
$ npm install @turf/isolines
import { isolines } from "@turf/isolines";
const result = isolines(...);javascript
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.isolines(...);