Skip to content

描述 ​

接收一组 points 并创建 Triangulated Irregular Network,或简称 TIN,作为多边形集合返回。这些通常用于开发高程等高线地图或阶梯式热可视化。

如果提供可选的 z 值属性,则将其作为名为 a、b 和 c 的属性添加,表示三角形角点处每个点的值。

参数 ​

名称类型描述
pointsFeatureCollection<Point>输入点
z?String从中获取 z 值的属性名称。这是可选的:如果未给出,则不会向派生的三角形添加额外数据。

返回值 ​

FeatureCollection<Polygon> TIN 输出

示例 ​

javascript
// 生成一些随机点数据
var points = turf.randomPoint(30, { bbox: [50, 30, 70, 50] });

// 为每个点添加 0 到 9 之间的随机属性
for (var i = 0; i < points.features.length; i++) {
  points.features[i].properties.z = ~~(Math.random() * 9);
}
var tin = turf.tin(points, "z");

安装 ​

javascript
$ npm install @turf/tin

import { tin } from "@turf/tin";
const result = tin(...);
javascript
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.tin(...);