1v.mkgrid(1) Grass User's Manual v.mkgrid(1)
2
3
4
6 v.mkgrid - Creates a vector map of a user-defined grid.
7
9 vector, geometry, grid, point pattern, hexagon
10
12 v.mkgrid
13 v.mkgrid --help
14 v.mkgrid [-ha] map=name [grid=rows,columns] [position=string]
15 [coordinates=east,north] [box=width,height] [angle=float]
16 [breaks=integer] [type=string] [--overwrite] [--help] [--verbose]
17 [--quiet] [--ui]
18
19 Flags:
20 -h
21 Create hexagons (default: rectangles)
22
23 -a
24 Allow asymmetric hexagons
25
26 --overwrite
27 Allow output files to overwrite existing files
28
29 --help
30 Print usage summary
31
32 --verbose
33 Verbose module output
34
35 --quiet
36 Quiet module output
37
38 --ui
39 Force launching GUI dialog
40
41 Parameters:
42 map=name [required]
43 Name for output vector map
44
45 grid=rows,columns
46 Number of rows and columns in grid
47
48 position=string
49 Where to place the grid
50 Options: region, coor
51 Default: region
52 region: current region
53 coor: use ’coor’ and ’box’ options
54
55 coordinates=east,north
56 Lower left easting and northing coordinates of map
57
58 box=width,height
59 Width and height of boxes in grid
60
61 angle=float
62 Angle of rotation (in degrees counter-clockwise)
63 Default: 0
64
65 breaks=integer
66 Number of vertex points per grid cell
67 Options: 0-60
68 Default: 0
69
70 type=string
71 Output feature type
72 Options: point, line, area
73 Default: area
74
76 v.mkgrid creates a vector map representation of a regular coordinate
77 grid. Point, line, and area vector grids can be created.
78
80 Grid points created with the type=point option will be placed at the
81 center of each grid cell, like centroids with the default type=area
82 option.
83
84 Grid lines created with the type=line option will be identical to the
85 edges of each grid cell, like boundaries with the default type=area
86 option.
87
88 The resultant grid can be rotated around the origin (center of the
89 grid) with the angle option.
90
91 Optionally hexagons can be created with the -h flag. Hexagons are by
92 default symmetric. Asymmetric hexagons can be allowed with the -a flag.
93
94 This module is NOT to be used to generate a vector map of USGS quadran‐
95 gles, because USGS quads are not exact rectangles.
96
98 Creating a global grid in a latitude-longitude
99 To be run in a latitude-longitude location (WGS84)
100 # set the region:
101 g.region n=90 s=-90 w=-180 e=180 res=10 -p
102 projection: 3 (Latitude-Longitude)
103 zone: 0
104 datum: wgs84
105 ellipsoid: wgs84
106 north: 90N
107 south: 90S
108 west: 180W
109 east: 180E
110 nsres: 10
111 ewres: 10
112 rows: 18
113 cols: 36
114 cells: 648
115 # create 10 degree size grid:
116 v.mkgrid map=grid_10deg
117 # create 20 degree size grid:
118 v.mkgrid map=grid_20deg box=20,20
119
120 Creating a grid in a metric projection
121 Creating a 4x3 grid, cells 20km a side, with lower left corner at
122 2716500,6447000:
123 v.mkgrid map=coro_grid grid=4,3 position=coor coordinates=2716500,6447000 box=20000,20000
124
125 Creating a positioned grid in a latitude-longitude
126 Creating a 10x12 lat/lon grid, cells 2 arc-min a side, with lower left
127 corner at 167deg 52min east, 47deg 6min south. For use with e.g. QGIS
128 you can then pull this grid into a projected location with v.proj
129 before exporting as a Shapefile with v.out.ogr (within GRASS GIS you
130 could just use d.grid -w from the projected location for the same
131 effect):
132 v.mkgrid map=p2min_grid grid=10,12 position=coor coordinates=167:52E,47:06S box=0:02,0:02
133
134 Creating a simple point pattern
135 North Carolina sample dataset example, creating a 1km spaced point grid
136 based on the current region extent defined by the "elevation" map:
137 g.region raster=elevation res=1000 -pa
138 v.mkgrid type=point map=pointpattern
139
140 Creating a regular point pattern
141 North Carolina sample dataset example, creating a regular spaced point
142 grid based on the current region extent defined by the "elevation" map,
143 using a two-step approach:
144 # create first set of points, covering extent of "elevation" raster map
145 g.region raster=elevation res=1000 -pa
146 v.mkgrid type=point map=pointpattern1
147 # shift grid by half point distance (map units)
148 g.region n=n+500 w=w+500 e=e+500 s=s+500 -p
149 # create second set of points
150 v.mkgrid type=point map=pointpattern2
151 # merge into final point pattern
152 v.patch input=pointpattern1,pointpattern2 output=pointpattern3
153 Different point patterns for sampling design
154
155 Creating hexagons in a metric projection
156 North Carolina sample dataset example, creating regular hexagons based
157 on the current region extent defined by the "elevation" map and raster
158 resolution for the hexagon size:
159 g.region raster=elevation res=5000 -pa
160 v.mkgrid map=hexagons -h
161 d.grid 5000
162 Hexagon map
163
164 Using hexagons for point density
165 To compute point density in a hexagonal grid for the vector map
166 points_of_interest in the basic North Carolina sample dataset, the vec‐
167 tor map itself is used to set extent of the computational region. The
168 resolution is based on the desired size of hexagons.
169 g.region vector=points_of_interest res=2000 -pa
170 The hexagonal grid is created as a vector map based on the previously
171 selected extent and size of the grid.
172 v.mkgrid map=hexagons -h
173 The following counts the number of points per hexagon using the
174 v.vect.stats module.
175 v.vect.stats points=points_of_interest areas=hexagons count_column=count
176 User should note that some of the points may be outside the grid since
177 the hexagons cannot cover all the area around the edges (the computa‐
178 tional region extent needs to be enlarged if all points should be con‐
179 sidered). The last command sets the vector map color table to viridis
180 based on the count column.
181 v.colors map=hexagons use=attr column=count color=viridis
182 Point density in a hexagonal grid
183
185 d.grid, v.in.region, v.patch, v.vect.stats
186
188 Michael Higgins, U.S.Army Construction Engineering Research Laboratory
189
190 Update for new vectors Radim Blazek 10/2004
191
192 Last changed: $Date: 2016-08-23 04:00:20 +0200 (Tue, 23 Aug 2016) $
193
195 Available at: v.mkgrid source code (history)
196
197 Main index | Vector index | Topics index | Keywords index | Graphical
198 index | Full index
199
200 © 2003-2019 GRASS Development Team, GRASS GIS 7.6.0 Reference Manual
201
202
203
204GRASS 7.6.0 v.mkgrid(1)