Skip to main content
Version: 7.0.0

pointGrid

Description

Creates a Point grid from a bounding box, FeatureCollection or Feature.

Parameters

NameTypeDescription
bboxArray<number>extent in [minX, minY, maxX, maxY] order
cellSidenumberthe distance between points, in units
options?ObjectOptional parameters (default {})
options.units?stringused in calculating cellSide, can be degrees, radians, miles, or kilometers (default 'kilometers')
options.mask?Feature<Polygon | MultiPolygon>if passed a Polygon or MultiPolygon, the grid Points will be created only inside it
options.properties?Objectpassed to each point of the grid (default {})

Returns

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(...);