v.mkgrid(1grass)
π v.mkgrid β GRASS User's Manual π
okay bestie, welcome to v.mkgrid, the tool that literally makes grids. it's giving geometry, it's giving point pattern, it's giving hexagons. no cap. π¦
β¨ NAME β¨
v.mkgrid β creates a vector map of a grid that you define, and she ate. π
π KEYWORDS π
vector, geometry, grid, point pattern, hexagon
πΈ SYNOPSIS πΈ
v.mkgrid
v.mkgrid --help
v.mkgrid [-had] map=name [grid=rows,columns] [position=string]
[coordinates=east,north] [box=width,height] [angle=float]
[breaks=integer] [type=string] [--overwrite] [--help] [--verbose]
[--quiet] [--ui]
π© Flags
-hβ makes hexagons instead of rectangles (rectangles are the default, iykyk)-aβ lets the hexagons be asymmetric (symmetric is the default vibe)-dβ EXPERIMENTAL: adds diagonals to rectangular lines. heads up: this one only applies to lines for rectangles, bestie--overwriteβ lets output files overwrite files that already exist--helpβ prints the usage summary--verboseβ verbose module output, for when you wanna know everything--quietβ quiet module output, for when you do NOT--uiβ force launches the GUI dialog
π§ Parameters
map=name[required] β the name for your output vector map, you gotta give her a name πgrid=rows,columnsβ how many rows and columns are in the gridposition=stringβ where to place the grid. Options:region,coor. Default:region.region= use the current region.coor= use thecoorandboxoptions.coordinates=east,northβ the lower left easting and northing coordinates of the mapbox=width,heightβ width and height of the boxes in the gridangle=floatβ angle of rotation, in degrees, counter-clockwise. Default:0breaks=integerβ number of vertex points per grid cell. Options:0-60. Default:0type=stringβ output feature type. Options:point,line,area. Default:area
π₯ DESCRIPTION π₯
v.mkgrid creates a vector map representation of a regular coordinate grid. you can make point vector grids, line vector grids, and area vector grids. three icons, one module. periodt. π
π NOTES π
- Grid points made with the
type=pointoption get placed at the center of each grid cell β literally the same spot as centroids with the defaulttype=areaoption. same energy. - Grid lines made with the
type=lineoption are identical to the edges of each grid cell, just like boundaries with the defaulttype=areaoption. - the resultant grid can be rotated around the origin (that's the center of the grid) with the
angleoption. - Optionally you can make hexagons with the
-hflag. hexagons are symmetric by default. Asymmetric hexagons can be allowed with the-aflag. π - This module is NOT to be used to generate a vector map of USGS quadrangles, because USGS quads are not exact rectangles. not me warning you, but like... i'm warning you. π
π EXAMPLES π
π Creating a global grid in a latitude-longitude
to be run in a latitude-longitude project (WGS84):
# set the region:
g.region n=90 s=-90 w=-180 e=180 res=10 -p
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 90N
south: 90S
west: 180W
east: 180E
nsres: 10
ewres: 10
rows: 18
cols: 36
cells: 648
# create 10 degree size grid:
v.mkgrid map=grid_10deg
# create 20 degree size grid:
v.mkgrid map=grid_20deg box=20,20
π Creating a grid in a metric projection
Creating a 4x3 grid, cells 20km a side, with lower left corner at 2716500,6447000:
v.mkgrid map=coro_grid grid=4,3 position=coor coordinates=2716500,6447000 box=20000,20000
πΊοΈ Creating a positioned grid in a latitude-longitude
Creating a 10x12 lat/lon grid, cells 2 arc-min a side, with lower left corner at 167deg 52min east, 47deg 6min south. For use with e.g. QGIS you can then pull this grid into a project with projected coordinate reference system (CRS) using v.proj before exporting as a vector file with v.out.ogr (within GRASS you could just use d.grid -w from the project with projected CRS for the same effect):
v.mkgrid map=p2min_grid grid=10,12 position=coor coordinates=167:52E,47:06S box=0:02,0:02
β¨ Creating a simple point pattern
North Carolina sample dataset example, creating a 1km spaced point grid based on the current region extent defined by the "elevation" map:
g.region raster=elevation res=1000 -pa
v.mkgrid type=point map=pointpattern
π― Creating a regular point pattern
North Carolina sample dataset example, creating a regular spaced point grid based on the current region extent defined by the "elevation" map, using a two-step approach:
# create first set of points, covering extent of "elevation" raster map
g.region raster=elevation res=1000 -pa
v.mkgrid type=point map=pointpattern1
# shift grid by half point distance (map units)
g.region n=n+500 w=w+500 e=e+500 s=s+500 -p
# create second set of points
v.mkgrid type=point map=pointpattern2
# merge into final point pattern
v.patch input=pointpattern1,pointpattern2 output=pointpattern3
Different point patterns for sampling design π
π Creating hexagons in a metric projection
North Carolina sample dataset example, creating regular hexagons based on the current region extent defined by the "elevation" map and raster resolution for the hexagon size:
g.region raster=elevation res=5000 -pa
v.mkgrid map=hexagons -h
d.grid 5000
Hexagon map π―
π Using hexagons for point density
To compute point density in a hexagonal grid for the vector map points_of_interest in the basic North Carolina sample dataset, the vector map itself is used to set extent of the computational region. The resolution is based on the desired size of hexagons.
g.region vector=points_of_interest res=2000 -pa
The hexagonal grid is created as a vector map based on the previously selected extent and size of the grid.
v.mkgrid map=hexagons -h
The following counts the number of points per hexagon using the v.vect.stats module.
v.vect.stats points=points_of_interest areas=hexagons count_column=count
Users should note that some of the points may be outside the grid since the hexagons cannot cover all the area around the edges (the computational region extent needs to be enlarged if all points should be considered).
The last command sets the vector map color table to viridis based on the count column.
v.colors map=hexagons use=attr column=count color=viridis
Point density in a hexagonal grid π
π SEE ALSO π
d.grid, v.in.region, v.patch, v.vect.stats
π«Ά AUTHORS π«Ά
Michael Higgins, U.S.Army Construction Engineering Research Laboratory
Update for new vectors Radim Blazek 10/2004
πΎ SOURCE CODE πΎ
Available at: v.mkgrid source code (history)
Latest change: Friday Aug 08 09:39:19 2025 in commit: ed72c71d8580e872cd6fd345c84a15c324764465
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
and that's the whole page bestie, pls go make a grid that slays πβ¨πΈ this was v.mkgrid from the GRASS 8.5.0 Reference Manual, footer date and all β Friday Aug 08 09:39:19 2025 was literally when she was last changed, and Β© 2003-2026 GRASS Development Team said so. mwah ππ¦
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms