GRASS logo


d.region.grid - Drapes a color raster over an shaded relief or aspect map.


display, elevation, relief, hillshade, visualization


d.region.grid --help
d.region.grid [-r] [region=name] [raster=name] [color=name] [width=float] [--help] [--verbose] [--quiet] [--ui]


Use the current computation region
This will not work in cases when region is handled in a special way such as GUI
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


Use an existing saved region
Use a raster map
Grid color
Default: gray
Grid line width

Table of contents


d.region.grid plots a grid defined by the computational region or by a raster map. The computational region can be the current computational region or a saved computational region.


Comparing grids of two rasters

To compare how grids (resolutions) of two rasters align, here a digital elevation model and a Landsat image, you can zoom to an area of interest and show grids of both rasters. First, zoom close enough that the raster cells become visible. Here a small saved region is used and a negative value for grow causes g.region to zoom-in even more:
g.region region=rural_1m grow=-250 -p
Start a monitor (skip this in the GUI):
d.mon start=cairo width=600 height=400 output=two_rasters.png
Optionally, show the digital elevation model and its shaded relief raster:
d.shade shade=elevation_shade color=elevation
Add grid for the elevation raster using a subtle color:
d.region.grid raster=elevation color="#9B520D"
Add grid for the Landsat raster using a high-contrast color:
d.region.grid raster=lsat7_2002_10 color=black

Figure: Grids of two rasters which are not aligned

If you are using d.mon, you can stop the monitor using:
d.mon stop=cairo

Showing the current computational region grid

Let's say you want to render grid cells of a computational region you plan to resample a raster map into. First, set the computational region to the raster map, then start the monitor (here we use file-based rendering in the command line with the cairo driver), and finally, render the raster map:
g.region raster=elevation
d.mon start=cairo width=600 height=400 output=new_region_grid.png
d.rast map=elevation
Then change to the desired computational region, here the new region resolution is set to 1000 meters (map units) and fitted into the current region extent without modifying the 1000 meters value.
g.region res=1000 -a
Now, you are ready to plot the grid of the current computational region:
d.region.grid -r

Figure: Raster with resolution 10 meters and grid of a computational region with resolution 1000 meters

Assuming you used d.mon to start rendering as in the code above, you can stop it using:
d.mon stop=cairo

Using an existing saved region

Displaying a saved computational region is extremely helpful in GUI, were you save the current region first:
g.region save=study_area
Then, you use Add command layer to add the following command:
d.region.grid region=study_area



g.region, d.grid, d.rast.num, d.mon, v.mkgrid


Vaclav Petras, NCSU GeoForAll Lab


Available at: d.region.grid source code (history)

Latest change: Wednesday Feb 02 21:46:15 2022 in commit: 2e3dcb5eafe36d640aa68585be0192f07ca1eabb

Main index | Display index | Topics index | Keywords index | Graphical index | Full index

© 2003-2022 GRASS Development Team, GRASS GIS 8.2.0 Reference Manual