pointGrid
Description
Creates a grid of points
Parameters
Name | Type | Description |
---|---|---|
bbox | BBox | extent of grid in [minX, minY, maxX, maxY] order |
cellSide | number | the distance between points |
options? | Object | Optional parameters (default {}) |
options.units? | Units | the units of the cellSide value. Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units} (default 'kilometers') |
options.mask? | Feature<Polygon | MultiPolygon> | if passed a Polygon or MultiPolygon, the grid Points will be created only inside it |
options.properties? | Object | passed to each point of the grid (default {}) |
Returns
FeatureCollection<Point> grid of points
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(...);