Skip to main content
Version: 6.5.0

squareGrid

Description

Creates a square grid from a bounding box.

Parameters

NameTypeDescription
bboxArray<number>extent in [minX, minY, maxX, maxY] order
cellSidenumberof each cell, 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 bbox = [-95, 30, -85, 40];
var cellSide = 50;
var options = { units: "miles" };

var squareGrid = turf.squareGrid(bbox, cellSide, options);

Installation

$ npm install @turf/square-grid

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

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