Skip to main content
Version: 7.3.0

pointGrid

描述

🌐 Description

创建点网格

🌐 Creates a grid of points

参数

🌐 Parameters

名称类型描述
bboxBBox网格范围,按 [minX, minY, maxX, maxY] 顺序
cellSidenumber点与点之间的距离
options?Object可选参数 (默认 {})
options.units?UnitscellSide 值的单位。支持所有有效的 Turf Units (默认 'kilometers')
options.mask?Feature<Polygon | MultiPolygon>如果传入的是多边形或多多边形,网格点将只在其内部创建
options.properties?Object传递到网格的每个点 (默认 {})

返回

🌐 Returns

FeatureCollection<Point> 点的网格

示例

🌐 Examples

var extent = [-70.823364, -33.553984, -70.473175, -33.302986];
var cellSide = 3;
var options = { units: "miles" };

var grid = turf.pointGrid(extent, cellSide, options);

安装

🌐 Installation

$ npm install @turf/point-grid

import { pointGrid } from "@turf/point-grid";
const result = pointGrid(...);
$ npm install @turf/turf

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