geo-registry

Create Grid

A layer of square or hexagonal cells of a given size covering another layer's extent.

Pitfall. Engines align the grid differently (to the extent's corner, or to multiples of the cell size), so cells and counts can differ.
About this operation
Also called Create Fishnet, Generate Tessellation, vector grid, hexagon grid, square grid
Group vector/geometry
Checks crs.measure
Pitfalls 1 listed above
Columbus tool Not stated
Notes Not stated
Status active
Broader Not stated
Narrower Not stated
Related

Parameters

Name Type Required Default Values Note
cell_size length yes Not stated Not stated Cell width, in the CRS's units (for hexagons, engines differ on which dimension).
shape enum no square square, hexagon Not stated

Inputs and outputs

Direction Name Type Geometry Note
Input layer vector Not stated The grid covers this layer's extent.
Output output vector polygon Not stated

In each engine

Engine Tool Parameters Differences
geopandas geopandas.make_grid
  • cell_size → cell_size
  • shape → grid_type
  • layer → input_geometry
  • Keeps only cells that intersect the geometry (intersect = True).
geopandas geopandas.GeoSeries.make_grid
  • cell_size → cell_size
  • shape → grid_type
  • Called on a GeoSeries; keeps only cells that intersect it.
grass v.mkgrid
  • cell_size → box : width and height: box=10,10.
  • shape → flag_h : square = no; hexagon = yes
  • layer The grid covers the computational region (position = region).
  • output → map
None noted
postgis st_hexagongrid
  • cell_size → size
  • shape always hexagon. ST_SquareGrid for squares.
  • layer → bounds
  • size is the hexagon's edge length; the grid is aligned to the origin.
postgis st_squaregrid
  • cell_size → size
  • shape always square. ST_HexagonGrid for hexagons.
  • layer → bounds
  • The grid is aligned to multiples of the cell size from the origin, not to the bounds' corner; returns (geom, i, j) rows for every cell that intersects the bounds, including cells that only touch their edge (121 cells of 10 m for a 100 m square at the origin, in the equivalence tests).
qgis native:creategrid
  • cell_size HSPACING and VSPACING: the cell width and height.
  • shape → TYPE : square = 2; hexagon = 4
  • layer → EXTENT
  • output → OUTPUT
None noted
sf sf::st_make_grid
  • cell_size → cellsize
  • shape → square : square = yes; hexagon = no
  • layer → x
  • The grid starts at the layer's bounding box corner (offset); n gives the number of cells instead of their size.
turf-js turf.squareGrid
  • cell_size → cellSide : In options.units (default kilometers).
  • shape always square. turf.hexGrid for hexagons.
  • layer bbox: [west, south, east, north] in longitude/latitude.
  • Turf works on GeoJSON in longitude/latitude (WGS 84); data in another CRS must be reprojected first.
whiteboxtools CreateRectangularVectorGrid
  • cell_size width and height: the cell's width and height.
  • shape always square. CreateHexagonalVectorGrid for hexagons.
  • layer → input
  • output → output
  • xorig and yorig set where the grid starts (default 0, 0).