rectangleGrid
描述
¥Description
创建矩形多边形网格,其宽度和高度以度为单位。
¥Creates a grid of rectangular polygons with width and height consistent in degrees
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
bbox | BBox | 按 [minX, minY, maxX, maxY] 顺序排列的网格范围。如果网格未完全填充边界框,则网格将居中。 |
cellWidth | number | 每个单元格的宽度(以单位为单位) |
cellHeight | number | 每个单元格的高度(以单位为单位) |
options? | 对象 | 可选参数(默认 {}) |
options.units? | 单位 | 单元格宽度和高度值的单位。支持所有有效的 Turf 单位。如果你正在寻找宽度和高度以线性单位(例如公里)相等的矩形,则此模块不适合你。cellWidth 和 cellHeight 会在内部将提供的单位转换为度,因此生成的多边形的宽度和高度仅在度数上保持一致。(默认 'kilometers') |
options.mask? | 特性<多边形 | MultiPolygon> | 如果传递的是多边形或多多边形,则网格点将仅在其内部创建。 |
options.properties? | 对象 | 传递给网格的每个点(默认 {}) |
返回
¥Returns
FeatureCollection<多边形> 多边形网格
¥FeatureCollection<Polygon> a grid of polygons
示例
¥Examples
var bbox = [-95, 30, -85, 40];
var cellWidth = 50;
var cellHeight = 20;
var options = { units: "miles" };
var rectangleGrid = turf.rectangleGrid(bbox, cellWidth, cellHeight, options);
安装
¥Installation
$ npm install @turf/rectangle-grid
import { rectangleGrid } from "@turf/rectangle-grid";
const result = rectangleGrid(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.rectangleGrid(...);