r.relief(1grass)

πŸ’– r.relief πŸ’–

okay bestie, gather round, because this is the GRASS GIS manual page for r.relief and it is literally the glow-up your elevation data has been waiting for ✨


🌸 NAME 🌸

r.relief β€” Creates shaded relief map from an elevation map (DEM).

🏷️ KEYWORDS 🏷️

raster, elevation, relief, terrain, hillshade


✨ SYNOPSIS ✨

r.relief
r.relief --help
r.relief input=name output=name  [altitude=float]   [azimuth=float]
[zscale=float]   [scale=float]   [units=string]   [--overwrite]
[--help]  [--verbose]  [--quiet]  [--ui]

πŸŽ€ Flags πŸŽ€

  • --overwrite β€” Allow output files to overwrite existing files (yes queen, it will simply replace what's there, so be sure you mean it πŸ™ˆ)
  • --help β€” Print usage summary
  • --verbose β€” Verbose module output
  • --quiet β€” Quiet module output
  • --ui β€” Force launching GUI dialog

🌈 Parameters 🌈

  • input=name [required] β€” Name of input raster (typically elevation) map
  • output=name [required] β€” Name for output shaded relief map
  • altitude=float β€” Altitude of the sun in degrees above the horizon
    • Options: 0-90
    • Default: 30
  • azimuth=float β€” Azimuth of the sun in degrees to the east of north
    • Options: 0-360
    • Default: 270
  • zscale=float β€” Factor for exaggerating relief
    • Default: 1
  • scale=float β€” Scale factor for converting meters to elevation units
    • Default: 1
  • units=string β€” Elevation units (overrides scale factor)
    • Options: intl, survey
    • intl: international feet
    • survey: survey feet

πŸ’… DESCRIPTION πŸ’…

r.relief creates a raster shaded relief map based on current resolution settings and on sun altitude, azimuth, and z-exaggeration values entered by the user. no cap, that's the whole deal πŸ’–

The parameters controlling the shading are:

  1. An input raster map to provide elevation values for the shaded relief map. Typically, this would be a map layer of elevation; however, any raster map layer can be named. (any map, bestie, you do you πŸ‘‘)
  2. The altitude of the sun in degrees above the horizon (a value between 0 and 90 degrees).
  3. The azimuth of the sun in degrees to the east of north (a value between 0 and 360 degrees; clockwise from north).
  4. The scaling parameter, which compensates for a different horizontal scale than vertical scale. If scale is a number, then the ewres and nsres are multiplied by that scale to calculate the shading. (Default=1.0 for equivalent horizontal and vertical scales.)
  5. The zscale exaggeration factor that changes the apparent relief for the shaded relief map. This can be any positive (or negative) floating point value. (default=1.0)
  6. Horizontal distances are calculated in meters, using geodesic distances for a latitude-longitude projection. With an elevation map measured in feet, the units option can be set to automatically convert meters to international feet (0.3048 meters = 1 foot) or survey feet (1200 / 3937 meters = 1 foot). The units parameter overrides the scale parameter.

r.relief assigns a grey-scale color table to the new shaded relief map. she comes pre-styled, periodt πŸ’…


πŸ“ NOTES πŸ“

To visually improve the result of shade maps from low resolution elevation models, use r.resamp.interp with bilinear or bicubic method to resample the DEM at higher resolution. r.relief is then run on the resampled DEM.

⚠️ The current mask is ignored. like, fully ignored. don't come for her about it 😭

πŸ¦‹ EXAMPLES πŸ¦‹

πŸŒ„ Shaded relief map

In this example, the aspect map in the North Carolina sample dataset is used to hillshade the elevation map:

g.region raster=elevation -p
r.relief input=elevation output=elevation_shade
r.relief: shaded elevation map (subset)

🌈 Colorizing a shaded relief map

Color can be added later using r.shade or d.shade:

r.shade shade=elevation_shade color=elevation output=elevation_shaded

🌍 Using the scale factor in Latitude-Longitude

In Latitude-Longitude coordinate reference systems (or other non-metric systems), the scale factor has to be used:

# Latitude-Longitude example
g.region raster=srtm -p
r.relief input=srtm output=srtm_shaded scale=111120

πŸ“¦ Exporting shaded relief maps to GeoTIFF

The data range of shaded relief maps usually does not permit exporting the map to GeoTIFF format along with its associated color table due to limitations in the GeoTIFF format.

The most simple way to export it while even reducing the file size is to export as palette byte map. This requires a conversion done in r.mapcalc, using the # operator to convert map category values to their grey scale equivalents:

# using the map created above
# create new map from map category values
r.mapcalc expression="elevation_shade_byte = #elevation_shade"
# verify data range
r.info elevation_shade_byte
# assign grey color table
r.colors elevation_shade_byte color=grey
# export (optionally: createopt="COMPRESS=DEFLATE,BIGTIFF=YES")
r.out.gdal input=elevation_shade_byte createopt="COMPRESS=DEFLATE" \
           output=elevation_shade.tif
# add overview images in GeoTIFF file for faster zooming
gdaladdo --config GDAL_CACHEMAX 2000 elevation_shade.tif 2 4 8 16

πŸ‘€ SEE ALSO πŸ‘€

d.shade, d.his, g.region, r.shade, r.blend, r.colors, r.mapcalc, r.resamp.interp


πŸ’œ AUTHORS πŸ’œ

Jim Westervelt, U.S. Army Construction Engineering Research Laboratory

Markus Metz: Enhanced fast C version of r.relief for GRASS GIS 7


πŸ”₯ SOURCE CODE πŸ”₯

Available at: r.relief source code (history)

Latest change: Thursday May 22 18:02:27 2025 in commit: 4003b4add3c8fdd4b5f41fc7c2b329aeaaa7653d

Main index | Raster 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 🫢 this vibe check was brought to you by GRASS 8.5.0, and the page you just read is the r.relief(1grass) manual page β€” go shade something iconic and stream that terrain πŸ’…βœ¨πŸŒ„

πŸ“¦ where this page comes from