triangleGrid
描述
¥Description
Creates a grid of triangular polygons.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
bbox | BBox | extent of grid in [minX, minY, maxX, maxY] order |
cellSide | number | dimension of each grid cell.Two triangles are created in each cell. |
options? | 对象 | 可选参数(默认 ) |
options.units? | 单位 | 用于计算 cellSide。Supports all valid Turf 单位 (default 'kilometers') |
options.mask? | 特性<多边形> | if passed a Polygon or MultiPolygon, the grid Points will be created only inside it |
options.properties? | 对象 | passed to each point of the grid (default ) |
返回
¥Returns
FeatureCollection<多边形> 多边形网格
¥FeatureCollection<Polygon> grid of polygons
示例
¥Examples
var bbox = [-95, 30, -85, 40];
var cellSide = 50;
var options = { units: "miles" };
var triangleGrid = turf.triangleGrid(bbox, cellSide, options);
安装
¥Installation
$ npm install @turf/triangle-grid
import { triangleGrid } from "@turf/triangle-grid";
const result = triangleGrid(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.triangleGrid(...);