isolines
描述
🌐 Description
使用带有 z 值的 Point 要素的网格 FeatureCollection 和一个值间隔数组,生成 等值线。
🌐 Takes a grid FeatureCollection of Point features with z-values and an array of value breaks and generates isolines.
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| 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 属性按顺序传递给对应的等值线;breaks 数组将定义创建等值线的顺序 (默认 []) |
返回
🌐 Returns
FeatureCollection<MultiLineString> 表示等值线的 MultiLineString 要素的 FeatureCollection
示例
🌐 Examples
// 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" });
安装
🌐 Installation
$ npm install @turf/isolines
import { isolines } from "@turf/isolines";
const result = isolines(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.isolines(...);